Sha256: d0feac136801d6222647d855fa5fc2d34ab5565faa007d78c9dfdb606e906e42

Contents?: true

Size: 462 Bytes

Versions: 2

Compression:

Stored size: 462 Bytes

Contents

# List all the files in a Tree of Directories
system = require 'system'

if system.args.length != 2
  console.log "Usage: phantomjs scandir.coffee DIRECTORY_TO_SCAN"
  phantom.exit()
scanDirectory = (path) ->
  fs = require 'fs'
  if fs.exists(path) and fs.isFile(path)
    console.log path
  else if fs.isDirectory(path)
    fs.list(path).forEach (e) ->
      scanDirectory path + "/" + e  if e != "." and e != ".."

scanDirectory system.args[1]
phantom.exit()

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
phantomjs.rb-0.0.2 vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/scandir.coffee
phantomjs.rb-0.0.1 vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/scandir.coffee