20 Sept 2016

search files by path length

Trying to back up or copy large volumes of files to an external hard drive? Process stalls when Windows encounters file names too long for the destination folder? It reports (for example) about 100 problems out of over 40,000 files but doesn't say what they are? Can you search for files based on the combined length of their path and file name? 

Command line solution

windowssecrets says:
  1. open up a command prompt, change to the folder from which you need to find the file with the longest path (or if you are looking to find the longest file on the whole drive, c: )
  2. Code: dir /b /s - which will give you a long list of files. 
  3. Save this to a text file using Code: dir /b /s > filelist.csv
Then you can open up your favourite spreadsheet package, for example Excel and import csv. In B column, use a formula like =Len(A1), and fill that down to the bottom of the list. Then you can sort by column B which will give you the list of files sorted by path length.

No comments:

Post a Comment