const path=require('path');
const fs = require('fs');
var arr=[];
function readF(p){
console.log('p',p);
var ret = fs.readdirSync(p,{withFileTypes:true}); //数组
for (var f of ret) {
var filep=path.join(p,f.name)
if(fs.statSync(filep).isDirectory()){ //是文件夹返回true
readF(filep); //递归 readF()
}
else arr.push(f);
}
}
网友评论