size limit to copyFile function

Does anyone know the size limitation to the string parameters for copyFile function?

string copyFile(string sourceFileName, string destFileName)
lsand - Thu Jun 23 16:39:06 EDT 2011

Re: size limit to copyFile function
Mathias Mamsch - Fri Jun 24 03:57:10 EDT 2011

Why would you think there is a size limitation? The path length seems to be restricted from the file system I would think. The maximum filename length (not path!) is 255 for most file systems. I think there was a maximum path length of 260 characters. Interestingly when doing a test on DOORS 8.2, DOORS will silently crash and end itself, when I tried copying a file with a pathlength of 260 to a file with path length 261 ... IS that what you observed? Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: size limit to copyFile function
lsand - Mon Jun 27 12:08:16 EDT 2011

Mathias Mamsch - Fri Jun 24 03:57:10 EDT 2011
Why would you think there is a size limitation? The path length seems to be restricted from the file system I would think. The maximum filename length (not path!) is 255 for most file systems. I think there was a maximum path length of 260 characters. Interestingly when doing a test on DOORS 8.2, DOORS will silently crash and end itself, when I tried copying a file with a pathlength of 260 to a file with path length 261 ... IS that what you observed? Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Yes, that is exactly what is happening. When I try to copy to a pathlengh (path + filename) over 260 the copyFile function returns an error that it can not copy the file over. Any thoughts on a way around it? I don't have the option to change the path to make the entire length of the string shorter than 260.

Re: size limit to copyFile function
Mathias Mamsch - Tue Jun 28 15:40:52 EDT 2011

lsand - Mon Jun 27 12:08:16 EDT 2011
Yes, that is exactly what is happening. When I try to copy to a pathlengh (path + filename) over 260 the copyFile function returns an error that it can not copy the file over. Any thoughts on a way around it? I don't have the option to change the path to make the entire length of the string shorter than 260.

Hmm ... I tried a bit but the results were not promising. I guess the most compatible way would be to use "subst" or "pushd" to map the long path to a new drive before you copy the file.

We are facing two problems here. The first one seems to be the windows specific restriction of 260 characters. It might be possible to overcome this using that magic \\?\ prefix before the filename, but the results I got were at least troublesome, since it generated files that could not be opened using the normal windows explorer. The second problem seems to be a buffer overrun which makes the DOORS client crash as soon as the filenames get a specific length. So it is probably really better to try substituting the long paths before copying.

Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: size limit to copyFile function
Mathias Mamsch - Tue Jun 28 15:45:48 EDT 2011

Mathias Mamsch - Tue Jun 28 15:40:52 EDT 2011
Hmm ... I tried a bit but the results were not promising. I guess the most compatible way would be to use "subst" or "pushd" to map the long path to a new drive before you copy the file.

We are facing two problems here. The first one seems to be the windows specific restriction of 260 characters. It might be possible to overcome this using that magic \\?\ prefix before the filename, but the results I got were at least troublesome, since it generated files that could not be opened using the normal windows explorer. The second problem seems to be a buffer overrun which makes the DOORS client crash as soon as the filenames get a specific length. So it is probably really better to try substituting the long paths before copying.

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

See here by the way:

http://msdn.microsoft.com/en-us/library/aa365247.aspx

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: size limit to copyFile function
llandale - Tue Jun 28 15:57:05 EDT 2011

lsand - Mon Jun 27 12:08:16 EDT 2011
Yes, that is exactly what is happening. When I try to copy to a pathlengh (path + filename) over 260 the copyFile function returns an error that it can not copy the file over. Any thoughts on a way around it? I don't have the option to change the path to make the entire length of the string shorter than 260.

I see that in Windows you cannot create a file whose full path name is larger than 260 characters. If you create a file whose path+name is 260, it will not let you rename the file longer. I see, however, that if you have such a 260 character file you can indeed rename one of its parent folders to a longer name, but when you go back down to the file and right-click you get a limited menu, but you cannot do anything with it, including opening or sending it to an application.

DOORS copyFile allows a 260 Target name, but it failes at 261 because Windows won't let it.

So clearly Windows has a 260 character limitiation on path+file, its not a DOORS thing.

I suspect that your NameFileFrom is value but your NameFileTo is too long; pretty easy to check:

print "Path Lengths: " (length(NameFileFrom)) "\t" (length(NameFileTo)) "\n"

  • Louie