Through this code i can able to write the filename in same file but thing is unable to save already existed data in the same file.
const testFolder = './2_27_2017/';
const fs = require('fs');
fs.readdir(testFolder, (err, files) => {
files.forEach(file => {
console.log(file.substring(0,file.length-4));
fs.writeFile('./2_27_2017/'+file, file.substring(-4), function(err) {
if(err) {
return console.log(err);
}
});
})
})
via Arun Wadikar
No comments:
Post a Comment