C #: Any way to overcome the 260 character limit of a fully traveled path?

Possible duplicate:
Why is there a path length limit of 260 characters on Windows?

I’m trying to find a way around this awful 260-digit full way limit, and at the same time I wonder why the hell is there a way limit? I know that some people think that "a lot", but this is really not the case, since I ran into this problem.

Basically:
Why should there be a character limit?
How to get around this?

+6
c # filepath
source share
3 answers

Use the \\?\ UNC prefix to exit DOS mode for paths. The maximum length for UNC paths is 32 thousand characters.

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

+11
source share

From MSDN :

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

+8
source share

Well, firstly, this has nothing to do with C # in particular, and everything related to the Windows API in which this limit is located. :)

Take a look at this question and its answers that will take you to MSDN: Naming Files, Paths, and Namespaces

Unicode file paths (described in the answers to the question and MSDN article) may be a solution with some caveats.

+1
source share

All Articles