Search code examples
c#limitfilepathmaxlengthmax-path

C#: Any way to get around the 260 character limit of a fully qualified path?


Possible Duplicate:
Why does the 260 character path length limit exist in Windows?

I'm trying to figure out a way to get around this dreaded 260 character fully qualified path limit and at the same time I wonder why the hell is there a path limit to begin with!? I know to some people 260 seems to be "a lot", but it truly isn't since I ran into this issue.

Basically:
Why must there be a character limit?
How does one get around it?


Solution

  • Use the \\?\ UNC prefix to break out of "DOS mode" for paths. The max length for UNC paths is 32k characters.

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