Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. let fs = require('fs');
  2. const path = './Kevin';
  3.  
  4. fs.readdir(path, (err, items) => {
  5. if (err) console.log(err);
  6. else {
  7. items.forEach(oldFile => {
  8. const name = oldFile.split('Port');
  9. name[1] = name[1].split(' ').join('_');
  10. let newName = name.join('Port');
  11.  
  12. fs.rename(oldFile, newName, err => {
  13. if (err) console.log(err);
  14. console.log('Kevin smd');
  15. });
  16. });
  17. }
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement