Function ShowLongFilenames(FolderSpec, MinLength)
Dim FSO, CurrentFolder, Iterator, ItemsCollection, temp
Set FSO = CreateObject("Scripting.FileSystemObject")
Set CurrentFolder = FSO.GetFolder(FolderSpec)
Set ItemsCollection = CurrentFolder.Files
For Each Iterator in ItemsCollection
If Len(Iterator.Path) >= MinLength Then
temp = temp & Iterator.Path & " - " & Len(Iterator.Path) & vbNewLine
End If
Next
set ItemsCollection = CurrentFolder.SubFolders
For Each Iterator in ItemsCollection
temp = temp & ShowLongFilenames(Iterator.Path, MinLength)
Next
ShowLongFilenames = temp
End Function
WScript.Echo ShowLongFilenames("c:\temp", 32)