Skip to content

Instantly share code, notes, and snippets.

@ebibibi
Created May 17, 2012 05:39
Show Gist options
  • Select an option

  • Save ebibibi/2716715 to your computer and use it in GitHub Desktop.

Select an option

Save ebibibi/2716715 to your computer and use it in GitHub Desktop.
[vbscript]get all files recursively
Set resultFiles = CreateObject("Scripting.Dictionary")
GetAllFiles "C:\tmp", resultFiles
For Each file in resultFiles.Items
WScript.Echo file.Path
Next
Function GetAllFiles(folder, resultFiles)
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(folder)
Set files = folder.Files
For Each file in files
resultFiles.Add resultFiles.Count, file
Next
Set subFolders = folder.SubFolders
For Each subFolder in subFolders
GetAllFiles subFolder.Path, resultFiles
Next
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment