elgin8949
(Elgin8949)
1
Description
This script will scan a selected folder for files and subdirectories, producing an output HTML file that contains the data.
The output file goes to the c: drive by default. To change this location, set the path in the ‘Set objHTML’ argument for the path needed.
Source Code
Set objDlg = WScript.CreateObject("Shell.Application")
Set objFile = objDlg.BrowseForFolder(&H0,"Select the Directory to Review",&H0001 + &H0010)
objStartFolder = objfile.ParentFolder.ParseName(objfile.Title).Path
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
Set objHTML = objfso.CreateTextFile("c:\File_Output.html",True)
With objHTML
.Write("<html>"+vbcrlf)
.Write("<table border = " & """1""" & ">"+vbcrlf)
.Write("<tr>"+vbcrlf)
.Write("<td>Folder</td>"+vbcrlf)
.Write("<td>File Name</td>"+vbcrlf)
.write("</tr>"+vbcrlf)
For Each Subfolder In OBJFolder.SubFolders
For Each objFile in colFiles
.Write("<tr>"+vbcrlf)
.Write("<td>"+objfolder.Name+"</td>"+vbCrLf)
.Write("<td>"+objfile.Name+"</td>"+vbcrlf)
.Write("</tr>"+vbcrlf)
Next
Set objFolder = objFSO.GetFolder(Subfolder)
Set colFiles = objFolder.Files
Next
.Write("</table>"+vbcrlf)
.Write("</html>"+vbcrlf)
End With
MsgBox "Process Complete"
Set SubFolder = Nothing
Set objHTML = Nothing
Set objFSO = Nothing
Set objFolder = Nothing
Set colFiles = Nothing
Set objStartFolder = Nothing