Created
October 24, 2017 20:33
-
-
Save JuanjoSalvador/81fb2e00e2db1d529c2a2625a97116c6 to your computer and use it in GitHub Desktop.
This file contains 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
const fs = require('fs') | |
const iconv = require('iconv-lite'); | |
function parse(path) { | |
let dir = fs.readdirSync(path) | |
dir.map(function(item) { | |
let uri = iconv.encode(path + "/" + item, 'utf-8') | |
fs.lstat(uri, (err, stats) => { | |
if(err) | |
return console.log(err); | |
if (stats.isDirectory()) { | |
parse(uri) | |
} | |
}) | |
}) | |
} | |
let path = '/home/juanjo/Música' | |
parse(path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment