展开全部
<!DOCTYPE HTML>
<html>
<head>
<title>Page Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script>
function ShowFolderFileList(folderspec, suffix) {
var fso, f, f1, fc, s;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFolder(folderspec);
fc = new Enumerator(f.files);
s = "";
for (; !fc.atEnd(); fc.moveNext()) {
try {
fc.item().Name = fc.item().Name.replace(/(.*)\..*/, "$1") + "." + suffix;
} catch (e) {
continue;
}
}
return (s);
}
// 修改为txt后缀
var x = ShowFolderFileList("i:/aaa", "txt");
console.log(x);
</script>
</head>
<body></body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询