|
@@ -107,7 +107,7 @@ function getLastFile(dirPath, number, callback) {
|
|
if (stats.isFile()) {
|
|
if (stats.isFile()) {
|
|
let tt = stats.birthtime.getTime();
|
|
let tt = stats.birthtime.getTime();
|
|
fileList.push({name: file, time: tt});
|
|
fileList.push({name: file, time: tt});
|
|
- logger.info("----------------所有文件:" + filePath + "时间:" + tt);
|
|
|
|
|
|
+ // logger.info("----------------所有文件:" + filePath + "时间:" + tt);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
@@ -125,16 +125,16 @@ function getLastFile(dirPath, number, callback) {
|
|
|
|
|
|
// 等待所有的 Promise 完成
|
|
// 等待所有的 Promise 完成
|
|
Promise.all(filePromises).then(() => {
|
|
Promise.all(filePromises).then(() => {
|
|
- for (a of fileList) {
|
|
|
|
- const filePath = path.join(dirPath, a.name);
|
|
|
|
- logger.info("复查:" + filePath + "\ttime:" + a.time)
|
|
|
|
- }
|
|
|
|
|
|
+ // for (a of fileList) {
|
|
|
|
+ // const filePath = path.join(dirPath, a.name);
|
|
|
|
+ // logger.info("复查:" + filePath + "\ttime:" + a.time)
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
|
fileList.sort((a, b) => b.time - a.time);
|
|
fileList.sort((a, b) => b.time - a.time);
|
|
for (a of fileList) {
|
|
for (a of fileList) {
|
|
const filePath = path.join(dirPath, a.name);
|
|
const filePath = path.join(dirPath, a.name);
|
|
- logger.info("排序:" + filePath + "\ttime:" + a.time)
|
|
|
|
|
|
+ // logger.info("排序:" + filePath + "\ttime:" + a.time)
|
|
}
|
|
}
|
|
let lastFileList = fileList.slice(0, number != -1 ? number : fileList.length);
|
|
let lastFileList = fileList.slice(0, number != -1 ? number : fileList.length);
|
|
let lastFileNameList = lastFileList.map((item) => item.name);
|
|
let lastFileNameList = lastFileList.map((item) => item.name);
|