Script to recursively scan through a folder structure and record the path of every file to an output list file.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject ("Shell.Application")
Set objFolder = objShell.BrowseForFolder (0, "Select Target Folder", (0))
targetPath = objFolder.Items.Item.Path
logName = objFolder.Title & " Scan.tsv"
Set objLogFile = objFSO.OpenTextFile(logName, 8, True)
If targetPath = "" Then
Wscript.Quit
End If
Set objFolder = objFSO.GetFolder(targetPath)
fileScan objFolder
Sub fileScan(objFolder)
'Loop through the files in the folder
For Each objFile In objFolder.Files
filename = objFile.Name
objLogFile.WriteLine(objFile.Path)
Next
For Each Subfolder In objFolder.SubFolders
fileScan Subfolder
Next
End Sub
Wscript.echo "Done"