Skip to content

Instantly share code, notes, and snippets.

@bittersweetryan
Created January 31, 2014 16:39
Show Gist options
  • Save bittersweetryan/8735812 to your computer and use it in GitHub Desktop.
Save bittersweetryan/8735812 to your computer and use it in GitHub Desktop.
var files = [];
function walkDirs( start ){
//since this is happening async how can I tell when it's done to process the files
fs.readdirSync( start, function( error, data ){
if( error ){
console.error( 'Oops!', error );
}
else{
data.forEach( function( dirItem ){
if( fs.lstatSync( start + '/' + dirItem ).isDirectory() ){
return walkDirs( start + '/' + dirItem );
}
else{
allFiles.push( dirItem );
}
});
}
} );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment