Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. function traverseDir(dir, first) { // рекурсивный перебор файлов
  2. fs.readdir(dir, (err, files) => {
  3. if (err) {
  4. return console.log('Unable to scan directory: ' + err);
  5. }
  6. files.forEach(file => {
  7. let fullPath = path.join(dir, file);
  8. fs.lstat(fullPath, (err, stats) => {
  9. if (err) {
  10. return console.log(err);
  11. }
  12. if (stats.isDirectory()) {
  13. traverseDir(fullPath);
  14. } else {
  15. console.log(fullPath);
  16. replace(fullPath);
  17. }
  18. })
  19. });
  20. });
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement