Québec said:
Hi,
I want to know the file name lenght for a software that does
not accept very long file names.
I would need a max subfolders algorithm to to get the number
of subfolders tree acceptable to the same software.
Jean Pierre
Here is a VBS that will show you the length of the file name, as well as the
full path. Save it as filename.vbs, and then run it like this:
cscript.exe filename.vbs
Remove the line numbers (use them to identify unwanted line
wraps)
01. Option Explicit
02. On Error Resume Next
03. Const SEARCH_FOLDER = "C:\Temp\"
04. Dim objFS, objFolder, objFile
05. Dim colFiles
06.
07. Set objFS = CreateObject("Scripting.FileSystemObject")
08. Set objFolder = objFS.GetFolder(SEARCH_FOLDER)
09. If Err.Number <> 0 Then
10. WScript.Echo "Failed to enumerate the folder '" & SEARCH_FOLDER &
"'"
11. WScript.Quit(3)
12. End If
13. Set colFiles = objFolder.Files
14.
15. WScript.Echo "INFO: "&CStr(colFiles.Count)&" files found in
'"&SEARCH_FOLDER&"'" & vbNewLine
16. For Each objFile in colFiles
17. WScript.Echo objFile.Name & ": " & CStr(Len(objFile.Name)) & "
(Including path: " & CStr(Len(objFile.Path)) & ")"
18. Next
19. WScript.Quit(0)