' A simple example of making a recursive list of files in a ' folder and all of its subfolders ' Derived from examples by Michael Harris, Torgier Bakken and ' others Dim ofs ' a global reference to an instance of the FileSystemObject Dim aFileSpecs With CreateObject("WScript.Shell") dpath = .SpecialFolders("MyDocuments") End With Set ofs = CreateObject("Scripting.FileSystemObject") ' One way to use the list is to break it up into an array aFileSpecs = Split(getList(dPath, ofs), vbNewline) wsh.echo "Found:", UBound(aFileSpecs), "file(s)" wsh.echo Join(aFileSpecs, vbNewLine) Function getList(sPath, ofs) Dim s s = "" With ofs.GetFolder(sPath) s = s & sPath & vbNewLine if .SubFolders.Count > 0 Then For each folder in .SubFolders s = s & getList(sPath & "\" & folder.Name, ofs) Next End if End With getList = s End Function