-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcleanFiles.js
43 lines (39 loc) · 954 Bytes
/
cleanFiles.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//Clean the folders
const fs = require('fs');
//clean files after 18 hours since it started (10 minutes each article 100 articles is about 16.30 minutes)
exports.cleanFilesW = () => {
console.log('Cleaning ...');
for (let j = 0; j < 100; j++) {
fs.unlink(`./texts/html-${j}.txt`, err => {
if (err) {
console.error(err);
return;
}
console.log('files removerd');
});
fs.unlink(`./tradus/html-${j}.txt`, err => {
if (err) {
console.error(err);
return;
}
console.log('files removerd');
});
}
};
exports.cleanFilesC = () => {
console.log('Cleaning ...');
fs.unlink(`./cheerioText/text-tradus.txt`, err => {
if (err) {
console.error(err);
return;
}
console.log('files removerd');
});
fs.unlink(`./cheeriotext/html.txt`, err => {
if (err) {
console.error(err);
return;
}
console.log('files removerd');
});
};