Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / phantomjs / lib / phantom / examples / scandir.coffee
1 # List all the files in a Tree of Directories
2 system = require 'system'
3
4 if system.args.length != 2
5   console.log "Usage: phantomjs scandir.coffee DIRECTORY_TO_SCAN"
6   phantom.exit 1
7 scanDirectory = (path) ->
8   fs = require 'fs'
9   if fs.exists(path) and fs.isFile(path)
10     console.log path
11   else if fs.isDirectory(path)
12     fs.list(path).forEach (e) ->
13       scanDirectory path + "/" + e  if e != "." and e != ".."
14
15 scanDirectory system.args[1]
16 phantom.exit()