▽1
●
a-kuma3 ●300ポイント ベストアンサー |
こんな感じになります。
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>" For Each f In targetFolder.Files If fs.GetExtensionName(f.Path) = "html" Then output.WriteLine "<tr><td>http://" & targetFolder.Name & "/" & f.Name & "</td></tr>" End If Next output.WriteLine "</table>" output.Close
他で質問されていることも考慮して、以下の処理もしています。
左端 真ん中 右端で使っているタグは違います
失礼しました。2列の TABLE なんですね。
では、こんな感じでは、いかがでしょうか。
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 f In targetFolder.Files If fs.GetExtensionName(f.Path) = "html" Then If odd Then output.Write "<tr><td>http://" & targetFolder.Name & "/" & f.Name & "</td>" odd = False Else output.WriteLine "<td>http://" & targetFolder.Name & "/" & f.Name & "</td></tr>" odd = True End If End If Next output.WriteLine "</table>" output.Close