file name length (simple)

  • Thread starter Thread starter Québec
  • Start date Start date
Q

Québec

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
 
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)
 
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


I didn't understand the part about the max subfolders algorithm, try asking
that again in a different way.
 
Lets say an application cant read deeper than two folders down. So it would
not read the useless folder.
EasyCd Creator do so for n th folders.

Some java packages are very long for example. I would like to list all the
lest say fith folder deep trees.

????upload
????WebmasterTools
? ????FindInFiles
? ????inset
? ????note
? ????popUpChromeless
? ????ProtoApplet
? ????search
?
????webpage
????3downDelme
????useless folder
 
Lets say an application cant read deeper than two folders down. So it
would not read the useless folder.
EasyCd Creator do so for n th folders.

Some java packages are very long for example. I would like to list all
the lest say fith folder deep trees.

????upload
????WebmasterTools
? ????FindInFiles
? ????inset
? ????note
? ????popUpChromeless
? ????ProtoApplet
? ????search
?
????webpage
????3downDelme
????useless folder
Dear <to the group>/Québc,
neiher the subject nor the contents of your messages give a hint what
you are after. It is a time wasting guessing game.
Please explain which app limitation disturbs you and what problems do
you have in developing a workaround.
? count sublevels in path ?
? count number of characters ?
whatsoever?
 
Lets say an application cant read deeper than two folders down. So it would
not read the useless folder.
EasyCd Creator do so for n th folders.

Some java packages are very long for example. I would like to list all the
lest say fith folder deep trees.
Sorry my other posting was a bit to fast.
::DirLevl5.cmd::::::::::::::::::::::::::::::::::::::
@echo off
for /F "tokens=*" %%A in ('dir /S/B/AD \') do (
for /F "tokens=6 delims=\" %%B in ("%%A") do (
if [%%B] NEQ [] echo %%A
))
::DirLevl5.cmd::::::::::::::::::::::::::::::::::::::
 
? count sublevels in path ?
yes
? count the number of characters ?
yes
in filenames without the path. They should not have names greater than 64
characters.

here is a simple workaround with dir. I can copy paste them ....
===
_Annoyances2k
2000 Hotfix Installation and Deployment Guide
Cannot Delete a File or a Folder_files
Differences Between Manual and Fast Repair_files
Edit the Boot_ini File in Windows XP_files
Enable Automatic Complete for (Cmd_exe)_files
Internet Explorer Client Registry Layout_files
Prompt in a Folder in Windows 2000_files
Q2345 - ReplacingSystemFilesModified Emergency Repair Disk_files
Run Recovery Console Using a Remote Server_files
Safe-Mode Boot Switches for Windows_files
Set Up a Remote Debug Session -Modem_files
Using a Modified Emergency Repair Disk_files
=========
This one is 65 char
Q2345 - ReplacingSystemFilesModified Emergency Repair Disk_files

Jean Pierre

NB:
Thanks for your code I cant test it now because my cmd.exe (or affiliated
files) is corrupted. I have to format c and reinstal everything since sfc
/scannow, the patches, pasks, recovery etc are useless.
 
? count sublevels in path ?
yes
? count the number of characters ?
yes
Found this link in google. Read in the file/dir with a for loop,
set the names to a variable and use the count routine in this thread:
http://groups.google.de/groups?th=84a626c786302401
Jean Pierre

NB:
Thanks for your code I cant test it now because my cmd.exe (or
affiliated files) is corrupted. I have to format c and reinstal
everything since sfc /scannow, the patches, pasks, recovery etc are
useless.
Hope your pc is up agagin ASAP ;-)
 
Back
Top