Filesystem

Finding Path lengths greater than MAX_PATH

If you’ve ever had anything to do with maintaining or migrating a fileserver you will probably have experienced issues with MAX_PATH. In Windows the maximum length for a path is MAX_PATH, which is defined as 260 characters. One of the most common errors for MAX_PATH is “Can’t access this folder. Path is too long.” This usually happens when users (those pesky users!) map a drive half way down a directory structure and started creating new files and folders.

You can find more information about MAX_PATH at the following locations:

I’ve seen a number of different ways of finding paths that are too long but my favourite at the moment is using the Microsoft Log Parser. Details:

Once you’ve downloaded LogParser you can run the following command to output a CSV file of paths greater than 250 characters:

LogParser “SELECT Path, Size FROM C:\*.* WHERE STRLEN(Path) > 250″ -i:FS -preserveLastAccTime:ON -o:CSV > Results.csv

Just change the “C:\*.*” to the location you want to check for long paths and Bob’s your uncle.

Read more