source: other-projects/FileTransfer-WebSocketPair/Themes/themebuilder/bin/phantomjs-1.9.2-windows/examples/scandir.js@ 31525

Last change on this file since 31525 was 31525, checked in by ak19, 7 years ago

Nathan provided more stuff: Themes folder contains Sencha's Themebuilder which generates GXT Themes. It includes the .theme and generated .jar files for the project theme.

File size: 618 bytes
Line 
1// List all the files in a Tree of Directories
2var system = require('system');
3
4if (system.args.length !== 2) {
5 console.log("Usage: phantomjs scandir.js DIRECTORY_TO_SCAN");
6 phantom.exit(1);
7}
8
9var scanDirectory = function (path) {
10 var fs = require('fs');
11 if (fs.exists(path) && fs.isFile(path)) {
12 console.log(path);
13 } else if (fs.isDirectory(path)) {
14 fs.list(path).forEach(function (e) {
15 if ( e !== "." && e !== ".." ) { //< Avoid loops
16 scanDirectory(path + '/' + e);
17 }
18 });
19 }
20};
21scanDirectory(system.args[1]);
22phantom.exit();
Note: See TracBrowser for help on using the repository browser.