Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function traverseDir(dir, first) { // рекурсивный перебор файлов
- fs.readdir(dir, (err, files) => {
- if (err) {
- return console.log('Unable to scan directory: ' + err);
- }
- files.forEach(file => {
- let fullPath = path.join(dir, file);
- fs.lstat(fullPath, (err, stats) => {
- if (err) {
- return console.log(err);
- }
- if (stats.isDirectory()) {
- traverseDir(fullPath);
- } else {
- console.log(fullPath);
- replace(fullPath);
- }
- })
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement