Skip to content

Instantly share code, notes, and snippets.

@selfish
Created August 13, 2014 15:47
Show Gist options
  • Save selfish/1aa974af0a0c80a4c27d to your computer and use it in GitHub Desktop.
Save selfish/1aa974af0a0c80a4c27d to your computer and use it in GitHub Desktop.
VBS Lookup files in folders. (Execute: cscript lookupXML.vbs)
On Error Resume Next
Dim fso, StdOut, folders, files, ext
folders = Array(_
"c:\",_
"c:\users"_
)
ext = ".xml"
Set fso = CreateObject("Scripting.FileSystemObject")
Set StdOut = fso.GetStandardStream (1)
StdOut.WriteLine ""
StdOut.WriteLine ""
StdOut.WriteLine "** Testing for XMLs:"
StdOut.WriteLine ""
StdOut.WriteLine ""
For each sFolder In folders
Set files = fso.GetFolder(sFolder).Files
For each folderIdx In files
If InStr(folderIdx.name, ".xml") > 0 Then
StdOut.WriteLine " > " + ext + " found in " + sFolder
End If
Next
Next
StdOut.WriteLine ""
StdOut.WriteLine ""
StdOut.WriteLine "** Tested all Dirs."
Wscript.Quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment