Windows 255 Char limit

Soldato
Joined
14 Oct 2003
Posts
7,831
This is a nice broken feature of Windows.

I am trying to copy some directories from one server to another. In some cases I think the dirs are roughly 4-5 levels deep.

On certain files the copy process breaks with file length errors. So, i count the length of the file (including spaces if any), which is nowhere near 255 chars (counted in Excel). I therefore count the path to the file and the file itself, and that is nowhere near 255 chars. For fun I make the filename slighly less in length, and the copy works. Hrmm. I also note that I have longer file names in the same dir, but these copy!

It also seems to depend on where in the structure you have a long directory name. I received directory length errors on directory names with many less chars in them, definitely a lot less than 255, but these "long" directories created were 2-3 levels deepers down the structure. The 'top' directories were very short in name, 5 - 6 chars. When counting this up, the total length was STILL less than 255.

Anyone seen this before? I assume this is a bug?
 
yes i've encountered this problem, i can't remember the exact reason why files that seem longer copy but for a quick and easy way of getting them across use xxcopy
 
Seen this loads of times. There is a 255 character limit on a path, which remember will also include the drive letter, colon and back slash. Some of the 255 limit are hidden control characters (or something like this) so you will never be able to create a path that comes close to 255, I think 250 is about as close as you can get.

There is however one way around this.

If the directory structure is deeply nested, then share one of the sub dirs and then connect to the share via explorer, rather than drill down from the root node.

For example,

On a path...

C:\test1\test2\test3\test4\test5\file

Share the test5 dir, and then connect via...

\\machinename\test5

19 rather than 26 characters in the above example.

Used to get this a lot with backup software where the backup would barf when it hit this limit.

Last bit of trivia, it is a limit of Windows NOT NTFS, as the NTFS supports 1024 paths, similar I believe to UNIX file systems such as ext3
 
Yes, but I was getting these errors on files and folders will lengths of 150-170 (including \\sharename\blah\blah\file.txt). There would have to be a huge number of control chars in that case, which I doubt.
 
Back
Top Bottom