One of our customers habitually use very long path names (several nested folders, with long names) and we routinely encounter 'user education issues' in order to shorten the path to less than 260 characters.
Is there a technical solution available, can we flick some sort of switch in Windows 7 and Windows 2008 R2 to say 'yeah just ignore these historical problems, and make +260 character path name work'.
P.S. I have read and been totally unedified by Naming Files, Paths, and Namespaces
Christopher EdwardsChristopher Edwards
Long Path Fixer is a FREE utility for moving, copying, renaming and deleting files and folders with Very Long Paths, that is paths longer than the Windows API.
4 Answers
The methods are there, but until Microsoft re-codes the file-browser widget we're pretty much stuck with that old problem. It's sub-optimal, but that's just how it works.
sysadmin1138♦sysadmin1138
Just mentioning a trick I do not see mentioned here yet.
Take this file for example:
C:Folder1Really Long PathSuch RecursionSo DeepWowStill GoingI will run out of ideas soonI have organizational problemsObsessive compulsive subdirectory disorderHere is a guid for no good reason936DA01F-9ABD-4d9d-80C7-02AF85C822A8Almost thereTax Returns20132013_tax_return.pdf
This full file path is 290 characters long. The shell (Windows Explorer) and most command line utilities probably won't let you touch it.
Use the
subst
command like so:Now you can access (and delete, move, etc.) the file thusly:
X:Still GoingI will run out of ideas soonI have organizational problemsObsessive compulsive subdirectory disorderHere is a guid for no good reason936DA01F-9ABD-4d9d-80C7-02AF85C822A8Almost thereTax Returns20132013_tax_return.pdf
And now that file name is only ~235 characters or so, so you will not encounter the 'Filename is too long' problems any more.
In the Windows API, there is an infamous constant known as
MAX_PATH
. MAX_PATH is 260 characters. The NTFS file system actually supports file paths of up to 32,767 characters. And you can still use 32,767 character long path names by accessing the Unicode (or 'wide') versions of the Windows API functions, and also by prefixing the path with ?
.MAX_PATH
was set in stone a very long time ago in the Windows world. I think it has something to do with ANSI standards at the time... but it's one of those things that's very difficult for Microsoft to change now, as now we have thousands of programs and applications, including some written by Microsoft themselves, that use MAX_PATH
and would fail in strange new ways if the constant were suddenly changed. (Buffer overflows, heap corruption, etc.)Ryan RiesRyan Ries
You can get around this limitation by using the ?C: notation. It's ugly, but it supports file lengths up to 2^15.
Chris KChris K
Microsoft now has an available fix for this beginning with Windows 10, which is explained in the Naming Files, Paths, and Namespaces MSDN article.
darthcoder already answered with details on the
?C:
notation work-around, but there is now a registry key at HKLMSYSTEMCurrentControlSetControlFileSystem LongPathsEnabled (Type: REG_DWORD)
which can be used to remove MAX_PATH limitations for a single system. The article also mentions support for Group Policy control at Computer Configuration > Administrative Templates > System > Filesystem > Enable NTFS long paths
for organization or group-wide implementation if needed.JimNimJimNim
protected by Sven♦Dec 26 '14 at 12:28
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Would you like to answer one of these unanswered questions instead?