PathTooLongException

Beowulf

New member
Joined
Oct 24, 2003
Messages
4
I have a C# .NET file copying program that does recursive copies of entire directories and contents. Everything has been going great until just recently... Ive run into a problem where I am getting a PathTooLongException thrown when the directory structure is particularly deep or I get an insanely long file name. The error message I am getting is:

"The path is too long after being fully qualified. Make sure path is less than 260 characters."

A 260 character limitation on the path has come as a big shock to me. Is there a way around this? Am I missing something obvious?
 
IIRC that is a limitation of windows itself - so the short answer is probably nothing can be done short of renaming the foles/folders to a shorter name or not nesting to quite that degree.
 
Hmmm... doing a little digging I found this in the Robocopy documentation (Robocopy is a nifty copy utility and is part of the Resource Kit):

"Previous versions of Robocopy would fail to copy any pathname longer than 256 characters. The program now has been enhanced to handle pathnames of any length, up to the internal Windows limit of nearly 32,000 characters."

This makes me think there is some setting in Windows or some other copy function that could be used which doesnt have the limited path length. For instance, I can drag-n-drop this entire directory structure and it copies without a complaint. Ive been Googling, but no luck yet on finding an answer.
 
Back
Top