daily pastebin goal
18%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top