mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 04:53:28 +02:00
Adjust console logs for deleting old files
This commit is contained in:
parent
c31ceeca86
commit
b7e939bbdd
1 changed files with 2 additions and 3 deletions
|
@ -162,7 +162,7 @@ function deleteOldFiles(directoryPath, maxAgeInSeconds, filenameRegex) {
|
|||
}
|
||||
|
||||
for (const filename of filenames) {
|
||||
console.log(filename);
|
||||
console.log("Checking", filename);
|
||||
const absolutePath = path.join(directoryPath, filename);
|
||||
var stat = null;
|
||||
try {
|
||||
|
@ -174,9 +174,8 @@ function deleteOldFiles(directoryPath, maxAgeInSeconds, filenameRegex) {
|
|||
const curTime = Date.now();
|
||||
if (stat.isFile() && filename.search(filenameRegex) >= 0) {
|
||||
const ageInSeconds = (curTime - stat.mtime.getTime()) / 1000.0;
|
||||
console.log("Match:", filename, ageInSeconds);
|
||||
if (ageInSeconds >= maxAgeInSeconds) {
|
||||
console.log("\tDeleting:", filename);
|
||||
console.log("\tDeleting:", filename, ageInSeconds);
|
||||
try {
|
||||
fs.unlinkSync(absolutePath);
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in a new issue