Thursday, March 12, 2009

Recursively Iterate through a folder

Set fs = WScript.CreateObject ("Scripting.FileSystemObject")

Sub ShowSubFolders(Folder)
For Each Subfolder In Folder.SubFolders
Set files = SubFolder.Files
For Each file In files
WScript.Echo file.Name, file.Size
Next
ShowSubFolders Subfolder
Next
End Sub

ShowSubFolders fs.GetFolder("C:\your\path\here")

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.