|
@@ -103,18 +103,18 @@ function getLastFile(dirPath, number, callback) {
|
|
// 按照倒叙获取,如果一个文件内容满足num,就不在继续查询,如果不够,继续获取文件
|
|
// 按照倒叙获取,如果一个文件内容满足num,就不在继续查询,如果不够,继续获取文件
|
|
for (file of files) {
|
|
for (file of files) {
|
|
const filePath = path.join(dirPath, file);
|
|
const filePath = path.join(dirPath, file);
|
|
- logger.info("所有文件:",filePath)
|
|
|
|
|
|
+ // logger.info("所有文件:",filePath)
|
|
const stats = await fs.promises.stat(filePath);
|
|
const stats = await fs.promises.stat(filePath);
|
|
if (stats.isFile()) {
|
|
if (stats.isFile()) {
|
|
fileList.push({name: file, time: stats.birthtime.getTime()});
|
|
fileList.push({name: file, time: stats.birthtime.getTime()});
|
|
- // logger.info("----------------文件:" + filePath + "时间:" + stats.birthtime.getTime())
|
|
|
|
|
|
+ logger.info("----------------所有文件:" + filePath + "时间:" + stats.birthtime.getTime())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
fileList.sort((a, b) => b.time - a.time);
|
|
fileList.sort((a, b) => b.time - a.time);
|
|
- for (a of fileList) {
|
|
|
|
- logger.info("文件基础信息:" + a.name + "\ttime:" + a.time)
|
|
|
|
- }
|
|
|
|
|
|
+ // for (a of fileList) {
|
|
|
|
+ // logger.info("文件基础信息:" + a.name + "\ttime:" + a.time)
|
|
|
|
+ // }
|
|
lastFileList = fileList.slice(0, number != -1 ? number : fileList.length);
|
|
lastFileList = fileList.slice(0, number != -1 ? number : fileList.length);
|
|
lastFileNameList = lastFileList.map((item) => item.name);
|
|
lastFileNameList = lastFileList.map((item) => item.name);
|
|
|
|
|