隐冲 let result=[]
明咐 function finder(path) {
let files=fs.readdirSync(path)
files.forEach((val,index) =>{
let fPath=join(path,val)
let stats=fs.statSync(fPath)
if(stats.isDirectory()) finder(fPath)
if(stats.isFile()) result.push(fPath)
})
}
finder(startPath)
激携纯 return result
}
let fileNames=findSync('./')
JS读写陵慎团文件,分别如下://读文件
function readFile(filename){
var fso = new ActiveXObject("Scripting.FileSystemObject")
var f = fso.OpenTextFile(filename,1)
var s = ""
while (!f.AtEndOfStream)
s += f.ReadLine()+"\n"
f.Close()
return s
}
//读文件
function readFile(filename){
var fso = new ActiveXObject("Scripting.FileSystemObject")
var f = fso.OpenTextFile(filename,1)
var s = ""
while (!f.AtEndOfStream)
s += f.ReadLine()+"\n"
f.Close()
return s
}
//写文尺橘件
function writeFile(filename,filecontent){
var fso, f, s
fso = new ActiveXObject("Scripting.FileSystemObject"孝腔)
f = fso.OpenTextFile(filename,8,true)
f.WriteLine(filecontent)
f.Close()
alert('ok')
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)