Overriding MAX_PATH

shiz

New member
Local time
9:11 PM
Messages
8
MAX_PATH is the 260 character limit Windows places on file paths. Apparently the NTFS file path limit is 32,767 characters, and since Windows uses that file system, I'm not sure what the massive restriction is for. Whenever I transfer files between hard drives of different file systems, this bloody MAX_PATH variable seems to happily get in the way, if only by a few characters. And to make matters worse, although Windows tells you about the names of the several hundred or so files that didn't quite make the transfer due to their paths being over 260 characters, it doesn't have the courtesy to tell you where exactly those files are.

Since I expect I will continue transferring files in the near future, I have started taking a look at what is out there to override MAX_PATH. So far I have heard of Robocopy and I shall have a more in-depth look at it soon. I expect that there are also other solutions out there and that people here have attempted them, so before I commit too much to one solution that might not necessarily be the best one, it would be great to hear of any viable alternatives. Ideally there would be something that could be done "in-house", i.e. without having to rely on third-party software, to override MAX_PATH, but I'm not expecting miracles.

Also, if anyone knows of any way to obtain a record of the paths of any files that encountered errors during transfers and thereby possibly didn't get transferred, your input on this would also be appreciated.

Thank you for any help.
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 Home Premium 64-bit
Just use Robocopy as it was designed for what you want. Its built into Windows 7 so its not third-party well in terms of Windows. Furthermore, the 255 limit is an NTFS limit. I don't know where you got 32,767 but that is not it.

That's what I thought, but some people on Wikipedia seem to think otherwise. :confused: Best not to use an encyclopedia run by the public, as they say.

It's great that Robocopy is built in. I'll try it out after my current transfer is finished.
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 Home Premium 64-bit
Misunderstanding on my part in the first post, however it still stands, use robocopy.

This is probably the infromation that you want:
Naming Files, Paths, and Namespaces (Windows)
Maximum Path Length Limitation

In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters. A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating null character. For example, the maximum path on drive D is "D:\some 256-character path string<NUL>" where "<NUL>" represents the invisible terminating null character for the current system codepage. (The characters < > are used here for visual clarity and cannot be part of a valid path string.)

Note File I/O functions in the Windows API convert "/" to "\" as part of converting the name to an NT-style name, except when using the "\\?\" prefix as detailed in the following sections.

The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters. This type of path is composed of components separated by backslashes, each up to the value returned in the lpMaximumComponentLength parameter of the GetVolumeInformation function (this value is commonly 255 characters). To specify an extended-length path, use the "\\?\" prefix. For example, "\\?\D:\very long path".

Note The maximum path of 32,767 characters is approximate, because the "\\?\" prefix may be expanded to a longer string by the system at run time, and this expansion applies to the total length.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Alienware Aurora ALX R4
OS
Windows 10 Pro (x64)
CPU
Intel Core i7-3930K (3.2GHz - 4.5GHz)
Motherboard
Alienware Aurora-R4 x79
Memory
4x Samsung 4GB PC3-12800 DDR3 (16GB 1600MHz)
Graphics Card(s)
Nvidia Geforce GTX 690
Sound Card
SteelSeries Siberia Elite
Monitor(s) Displays
Dell UltraSharp U3011
Screen Resolution
2560x1600
Hard Drives
Samsung 850 Pro 256 GB, Seagate 1TB Desktop Hybrid HDD, 2x Western Digital 4TB Green HDD
PSU
875W Some Dell PSU <.<
Case
Alienware Aurora ALX
Cooling
Custom Liquid Cooling (EK CPU & GPU blocks) dual EK 480RAD
Keyboard
Logitech G710+ Mechanical
Mouse
Logitech G700s
Internet Speed
Verizon Fios (50 mbps average)
Other Info
Server: Intel NUC D54250WYK: i5-4250U, 16GB, 256 GB mSATA, Windows Server 2012 R2
MAX_PATH isn't a parameter you can modify with some obscure registry technique, but rather is a constant defined in the Win32API C header files. The value comes from a limitation in the Windows API itself, as many file-handling functions take this value as the maximum allowable path length, so further folders would be truncated and programs react by preventing generating them in the first place. While the NTFS filesystem does allow longer paths, Windows itself cannot handle them correctly sometimes (I guess for compatibility reasons).
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba Sattelite A665-S6092
OS
Windows 7 Ultimate x64
CPU
Intel Core i7-740QM
Memory
8 GB DDR3
Graphics Card(s)
NVIDIA GeForce 330GT
Screen Resolution
1366x768
Hard Drives
Samsung 840 SSD 500GB
1TB USB3 external HD
Cooling
Coolermaster Notepal U3 notebook cooling pad
Internet Speed
3mbps ASDL
Antivirus
ClamWin 0.98.7
Browser
Opera 12.17 x86 (main), Firefox 38 (sec), IE11 (last resort)
The NTFS file system has a maximum path limit of 32767 bytes. But you can only realize that if the software you are using doesn't impose a lower limit. As it turns out, many system functions and software do impose a lower limit of MAX_PATH. Changing this value is so close to impossible as to not matter.

At this point in time Microsoft can't change the value of MAX_PATH. Doing so would break an enormous amount of existing software.

You have 2 choices:
1. Use file copying software, such as Robocopy, that does not have the MAX_PATH limit. This will allow you to copy files with a long path but that won't help with software that recognizes this limit.
2. Keep path lengths within the limit.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
Windows 7 Pro 64 bit
CPU
Xeon W3520
Memory
8 GB
Graphics Card(s)
Nvidia Geforce 210
Bypass MAX_PATH using drag-and-drop?

robocopy works, but I wish there were some way to bypass max_path from startup using built-in drag-and-drop instead of having to start a program in admin mode and double-check precise commands. It might be fine for the occasional backup but when every other move is affected it starts getting annoying.
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 Home Premium 64-bit
Back
Top