Windows has a limit on the length of file paths

While moving a folder, with many subdirectories, to the Recycle Bin under Windows XP:

I wondered if each file that is stored in the recycle bin has a "original path" attribute, with a max length 256 chars, and that stores the original path like "Dir1Dir2Dir3file.txt". Maybe if files are nested too deeply that attribute cannot hold the value?

It really seems that Windows does indeed have a path length limit.

While checking some files into a subversion repository:

While checking in all this stuff, I got the error "path invalid" suddenly. And opening the created .svn directory in Windows Explorer, right-clicking, and chooseing "new directory" immediately brought up the error:

Cannot create 'New Folder': path invalid

So it seems paths have a limit in Windows. The existing working path was 220 characters long, with 20 directories including the working directory and the hard disk's root directory.

This is all very annoying, as I can't really do anything about any of the above reasons why the path is so long.

This article is © Adrian Smith.
It was originally published on 21 Mar 2007
More on: FAIL | Operating Systems | Windows