i wants to save the fiilename in samefile and the format is like that
Filename:02_27_2017_...@gmail.com_9_45_45_PM.wav
want the above filename in same file as
02_27_2017
9_45_45
like this
Please i want to write the filename in samefile i did that one like below but its actually removing the already existed data in the same file and writing the same file name itself.
const testFolder = './tests/';
const fs = require('fs');
fs.readdir(testFolder, (err, files) => {
files.forEach(file => {
console.log(file.substring(0,file.length-4));
fs.writeFile('./tests/'+file, file.substring(-4), function(err) {
if(err)
{
return console.log(err);
}
});
})
})
so i want to keep the alrady existed data how i can please let me know...thanks