我正在编写一个需要列出来自多个路径的文件的小应用程序。
我试图做这样的事情,但它只向我展示了第一条路径。
任何线索为什么会这样?
这是代码:
var wsh = new ActiveXObject("WScript.Shell");
var FSO = new ActiveXObject("Scripting.FileSystemObject");
function window.onload() {
var s = "";
var paths = FSO.OpenTextFile("bin\\paths.txt")
while (!paths.AtEndOfStream) {
content = paths.ReadLine();
s += content;
loadMediaFolders(s);
}
stat.innerHTML= s;
}
function loadMediaFolders(wathPath) {
var str = "";
var folder = FSO.GetFolder(wathPath);
var mainFolders = new Enumerator(folder.SubFolders);
for (; !mainFolders.atEnd(); mainFolders.moveNext()) {
var FolderPath = mainFolders.item().Path;
var files = FSO.GetFolder(FolderPath);
var sbFiles = new Enumerator(files.Files);
for (; !sbFiles.atEnd(); sbFiles.moveNext()) {
var FilleName = sbFiles.item().Name;
str += FilleName;
}
}
stat.innerHTML= str;
}
这是路径在文件中的存储方式:
F:\\stuff\\Media\\Movies\\
D:\\Media\\Movies\\