var fs = require("fs");
const {join} = require("path");
function findFilesPath(startPath) {
let result = [];
function finder(path) {
let pathArray = fs.readdirSync(path);
pathArray.forEach((val, index) => {
let fPath = join(path, val);
let stats = fs.statSync(fPath);
if (stats.isDirectory()) finder(fPath);
if (stats.isFile()) {
//fs.utimes(path,atime,mtime,callback)
//atime:访问时间
//mtime:修改时间
fs.utimes(fPath, new Date(), (new Date('2021-09-14 17:04')), function (err) {
if (err) {
console.log("修改时间失败")
throw err;
}
})
result.push(fPath);
}
});
}
finder(startPath);
console.log(result);
return false;
}
findFilesPath('F:/my-project/myNode/demo');最后推广一波服务器 3年 2核4G 宽带8M 硬盘80G 只要198块 相当优惠呀
【腾讯云】云产品限时秒杀,爆款2核4G云服务器首年74元
版权声明:本文为qjhsmd2015原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。