hoge フォルダの中に
hoge
|-01
|-02
|-03
|-04
|-・
|-・
|-・
と数字の連番の名前がついたフォルダが入っています
その各数字フォルダの中にa.htmlが入っています。
hogeの一つ上のフォルダに以下のようにテキストが入力されたhtmlファイルを作りたいのですがどのようなVBSを組めばいいでしょうか?教えてください
hoge.html
***************
<tr><td>http://hoge/a.html</td><td>http://hoge/b.html</td></tr>
<tr><td>http://hoge/c.html</td><td>http://hoge/d.html</td></tr>
<tr><td>http://hoge/・.html</td><td>http://hoge/・.html</td></tr>
・
・
・
***********
こんな感じになると思います。
targetFolderName = "D:\test\hoge" ' ※ hoge フォルダのパス Set fs = WScript.CreateObject("Scripting.FileSystemObject") Set targetFolder = fs.getFolder(targetFolderName) Set parentFolder = targetFolder.ParentFolder Set output = fs.CreateTextFile(parentFolder.Path & "\list.html", True) output.WriteLine "<table>" odd = True For Each folder In targetFolder.SubFolders For Each f In folder.Files If f.Name = "a.html" Then If odd Then output.Write "<tr><td>http://" & targetFolder.Name & "/" & folder.Name & "/" & f.Name & "</td>" odd = False Else output.WriteLine "<td>http://" & targetFolder.Name & "/" & folder.Name & "/" & f.Name & "</td></tr>" odd = True End If End If Next Next output.WriteLine "</table>" output.Close
コメント(0件)