1 # List all the files in a Tree of Directories
2 system = require 'system'
4 if system.args.length != 2
5 console.log "Usage: phantomjs scandir.coffee DIRECTORY_TO_SCAN"
7 scanDirectory = (path) ->
9 if fs.exists(path) and fs.isFile(path)
11 else if fs.isDirectory(path)
12 fs.list(path).forEach (e) ->
13 scanDirectory path + "/" + e if e != "." and e != ".."
15 scanDirectory system.args[1]