1

We have some network shares and I daily receive support calls from users due to file paths which are too long. I recommend to use short folder names and avoid to deeply nest them, but my users always have new good reasons to be verbose. They need very long folder names with a detailed description of the content. Sometimes they simply unzip files created by others inside the appropriate network sub-folder and they don't even notice the extremely long names.

File system is a very easy and practical way to archive files but perhaps it is not what they really need. An abstraction layer could help, something that maps long, verbose evocative names to folder and files. It could be realized with a database or a simple excel file but it seems overkill, especially if the task of updating the map is left to the users.

There is an application, TLPD, which scans for long file path. I have never used it but perhaps it can be put in a script to notify the file owner, so he can rename or move the folders before any issue occurs.

Is there another approach to this problem ?

Please consider that we have an heterogeneous windows domain so we cannot exceed the 'old' limit of about 250 characters.

UPDATE

I read the suggested post but I was already conscious there was no practical way to overcome that limit. I'm looking for tools and procedures that can mitigate the problem. We have some folder names which are longer than 100 characters. Is there any easy alternative to store that information ?

1
0

TLPD does indeed look like a 90% fit for your problem.

The main problem with TLPD is that it only goes as far as making you a log file.

IMO, I would argue that the task of listing files and figuring out what paths are too long would be about as complex as parsing that log file, at the end of the day.

So I would recommend fiddling with PowerShell to get a recursive listing, filtering for names that are too long, going through the resulting list, getting the file owner and then mailing them.

Each of these steps is simple and popular so there is a lot of Googleable information about each. Wiring the pieces together would be a case of, at worst, a stackoverflow post :)

Perhaps someone running Windows might provide a better answer that actually implements some/all of this. :)

1

Beware of TLPD!

I only started to use TLPD v4.6 recently on a windows 2016 box. We had a merging of 2 orgs, and the data migration of a total of 9TB was around cut into some 1.5TB chunks.

We use Robocopy to copy over data as it should handle long file names, so i created some long dir names like "1 the quick brown fox jumps over the lazy dog" and copied that into "2 the quick brown..." 46 characters for each directory to test robocopy. The problem was there were a lot of directories on long paths, but had no files - so TLPD informed me

So at home on my windows 10 box Version 10.0.18362 Build 18362, again used TLPD on folder I created.

 c:\temp\1 the quick brown dog jumps over the lazy dog\2 the quick brown dog jumps over the lazy dog\3 ...

5 of these with a threshold a 240 character indicates 242 dir. C:\temp\5 the quick brown Copy 5 into 6th and you get 242 dir. C:\temp\6 the quick brown < it has stopped counting and cut off "**1** the quick brown..." so transversed 7 levels deep?

If my folder, creating this path "C:\temp\8\7\6\5\4\3\2\1" and selecting a threshold of 6 (or 10) it generates

11  dir.    C:\temp\8\7 < Where are the missing folder?

So created my own long name folders 2 of them. Only used windows 10 explorer, no fancy software or addons, and this is my result.

Length  Type    Full Path Name
245    dir.    D:\temp\this is a very log folder will all good men come to 
the aid of the party the quick brown fox jumped over the dog\Hong Kong 
leader Carrie Lam open to the possibility of overhauling cabinet when 
protest crisis dies down Bernie Sanders Adds
=== TLPD finished ===.

If I run powershell command below I get the output below that shows TDLP missed the largest folder. If I make the threshold 100, it misses both of the largest folders.

247 : D:\temp\this is a very log folder will all good men come to the aid 
of the party the quick brown fox jumped over the dog\Hong Kong leader 
Carrie Lam open to the possibility of overhauling cabinet when protest 
crisis dies down Bernie Sanders Adds\A
245 : D:\temp\this is a very log folder will all good men come to the aid 
of the party the quick brown fox jumped over the dog\Hong Kong leader 
Carrie Lam open to the possibility of overhauling cabinet when protest 
crisis dies down Bernie Sanders Adds
149 : D:\temp\Angry over Brexit, thousands gather in London demanding new 
referendum Why This Nebraska Democrat Thinks She Can Get Elected In Trump 
Country
120 : D:\temp\this is a very log folder will all good men come to the aid 
of the party the quick brown fox jumped over the dog

If I make really long nested folders, again TLPD recognised the path as 247, but it real length is 572. At work I got a better? result, but now think that stuff could be missing, and just too inconsistent.

code taken from https://stackoverflow.com/questions/12697259/how-do-i-find-files-with-a-path-length-greater-than-260-characters-in-windows

Get-ChildItem -Path $pathToScan -Recurse -Force | Select-Object -Property 
FullName, @{Name="FullNameLength";Expression={($_.FullName.Length)}} | 
Sort-Object -Property FullNameLength -Descending | ForEach-Object {
$filePath = $_.FullName
$length = $_.FullNameLength
$string = "$length : $filePath"

# Write to the Console.
if ($writeToConsoleAsWell) { Write-Host $string }

#Write to the file.
$stream.WriteLine($string)
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.