Find paths with too-long names
Option Explicit If WScript.Arguments.Count <> 2 Then WScript.Echo "Usage: " & WScript.ScriptName & " <path> <max length>" WScript.Quit End If Dim fso : Set fso = CreateObject("Scripting.FileSystemObject") If fso.FolderExists(WScript.Arguments(0)) = False Then WScript.Echo WScript.Arguments(0) & " - Invalid path or no such folder." WScript.Quit End If Dim oFolder : Set oFolder = fso.GetFolder(WScript.Arguments(0)) Dim iLength : iLength = CInt(WScript.Arguments(1)) Dim iCount : iCount = 0 WScript.Echo "Looking for paths longer than " & iLength & " characters in " & oFolder.Path >>WScript.Arguments(2) On Error Resume Next Call ScanFolder(oFolder) On Error Goto 0 WScript.Echo "Found " & iCount & ".">>WScript.Arguments(2) WScript.Quit Sub ScanFolder(oScanFolder) Dim oFile : For Each oFile in oScanFolder.Files If Len(oFile.Path) > iLength Then WScript.Echo oFile.Path>>WScript.Arguments(2) iCount = iCount + 1 End If Next For Each oFile in oScanFolder.SubFolders Call ScanFolder(oFile) Next End Sub