I need to be able to count the number of characters in a full path to a file in windows. How I am currently accomplishing this task is as follows:
- Open a command prompt
- cd to the directory in question (for example c:\CruiseControl\ProjectArtifacts\ProjectName)
- type the following command
dir /s /b > output.csv - Open the resulting output.csv file in excel.
- use the =LEN() function in excel to count the number of characters per row as listed in the output.csv file.
Does anyone know of an explorer shell extension, or some 3rd party tool that could preform this function without me having to manipulate the output from dir in excel? Is there some easier way to go about doing this? The root of the issue I am having is the ~260 character file path limit in Windows. I am trying to analyze which paths are approx ~260 characters so I can shorten them to avoid getting this error.
Answer
This kind of thing is very easy to do with Hamilton C shell. If this a one-time thing, you'll be happy with the free version. Here's an example generating the fullpaths of several files in the c:\Windows
directory, then computing the string lengths. Full disclosure: I'm the author.
128 C% cd
c:\Windows
129 C% ls mi*
Microsoft.NET Minidump mib.bin
130 C% foreach i ( mi* )
131 C? @ f = fullpath ( i )
132 C? echo $i $f $strlen(f)
133 C? end
mib.bin c:\Windows\mib.bin 18
Microsoft.NET c:\Windows\Microsoft.NET 24
Minidump c:\Windows\Minidump 19
134 C%
No comments:
Post a Comment