|
@@ -106,15 +106,21 @@ function getLastFile(dirPath, number, callback) {
|
|
|
// logger.info("所有文件:",filePath)
|
|
|
const stats = await fs.promises.stat(filePath);
|
|
|
if (stats.isFile()) {
|
|
|
- fileList.push({name: file, time: stats.birthtime.getTime()});
|
|
|
- logger.info("----------------所有文件:" + filePath + "时间:" + stats.birthtime.getTime())
|
|
|
+ let tt = stats.birthtime.getTime()
|
|
|
+ fileList.push({name: file, time: tt});
|
|
|
+ logger.info("----------------所有文件:" + filePath + "时间:" + tt)
|
|
|
}
|
|
|
}
|
|
|
+ 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);
|
|
|
for (a of fileList) {
|
|
|
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 lastFileNameList = lastFileList.map((item) => item.name);
|