Skip to content

Instantly share code, notes, and snippets.

@Avaray
Last active November 1, 2017 15:37
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 Avaray/b38c5421b6e7dc013458ed8903cf0d69 to your computer and use it in GitHub Desktop.
Save Avaray/b38c5421b6e7dc013458ed8903cf0d69 to your computer and use it in GitHub Desktop.
Node JS // Get list of all directories (not recursive)
var fs = require('fs')
var path = require('path')
var location = 'content'
fs.readdirSync(location)
.filter(x => {
return fs.lstatSync(path.join(location, x)).isDirectory()
})
.forEach(dir => {
console.log(dir)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment