Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fs = require 'fs'
- path = require 'path'
- getPaths = (startPath) ->
- dirs = [startPath] # push/shift
- files = []
- bfs = (target) ->
- ls = fs.readdirSync target
- ls = ls.filter((x)->x.indexOf(".")!=0).map((x)->path.join(target, x))
- dirs = dirs.concat ls.filter (x)->fs.lstatSync(x).isDirectory()
- files = files.concat ls.filter (x)->fs.lstatSync(x).isFile()
- bfs(dirs.shift()) until dirs.length==0
- return files
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement