Skip to content

Instantly share code, notes, and snippets.

@dantheman213
Created January 22, 2016 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dantheman213/112499c7a413814e5c5e to your computer and use it in GitHub Desktop.
Save dantheman213/112499c7a413814e5c5e to your computer and use it in GitHub Desktop.
This script will allow you to prune large collections of files by removing duplicates, fixing filename syntax, and organize better
#!/usr/bin/env node
// required packages
// npm install walk
// libraries
var walk = require('walk');
// globals
var args = process.argv.splice(2);
var files = [];
console.log(args);
process.exit(0);
var walker = walk.walk('./test', { followLinks: false });
walker.on('file', function(root, stat, next) {
// Add this file to the list of files
files.push(root + '/' + stat.name);
next();
});
walker.on('end', function() {
console.log(files);
// TBD
console.log('complete.');
process.exit(0);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment