Created
April 28, 2016 08:53
-
-
Save TimJMartin/77148741d1d2f91e9007e03ff38ea72b to your computer and use it in GitHub Desktop.
NodeJS Script for finding just zip files from a path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Code snipped to use recursive-readdir to provide a list of required file types. | |
var path = require('path'); | |
var recursive = require('recursive-readdir'); | |
function ignoreFunc(file, stats) { | |
// `file` is the absolute path to the file and we can use extname to look at the file extension | |
return stats.isFile() && path.extname(file) != ".zip"; | |
} | |
// Ignore files using the ignroeFunc | |
recursive('/somePath/', [ignoreFunc], function (err, files) { | |
// Files is an array of filename | |
console.log(files); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment