Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 40197
  • Last Modified:

Maximum Path Length - Windows 2000, XP, 2003

I have a large file system and am having difficulties with deeper folder levels hitting the maximum path length.  I have seen article talking about the "\\?\" prefix to enable 32,000+ characters, rather than the standard ~255.  I do not know if this can be applied.
I need to use Windows File System normally (i.e. Explorer - via GUI), but with long paths.  Is there any setting (anything else?) that will allow for this?
Thanks if someone can advise...
0
DevelopHer
Asked:
DevelopHer
  • 3
1 Solution
 
DVation191Commented:
In the Windows API, the maximum length for a path is MAX_PATH, which is defined as 260 characters. A path is structured as follows: drive letter, colon, backslash, components separated by backslashes, and a null-terminating character. For example, the maximum path on the D drive is D:\<256 chars>NUL.

The Unicode versions of several functions permit a maximum path length of 32,767 characters, composed of components up to 255 characters in length. To specify such a path, use the "\\?\" prefix. For example, "\\?\D:\<path>". To specify such a UNC path, use the "\\?\UNC\" prefix. For example, "\\?\UNC\<server>\<share>". Note that these prefixes are not used as part of the path itself. They indicate that the path should be passed to the system with minimal modification. An implication of this is that you cannot use forward slashes to represent path separators or a period to represent the current directory. Note also that you cannot use the "\\?\" prefix with a relative path. Therefore, relative paths are limited to MAX_PATH characters.

When using the API to create a directory, the specified path cannot be so long that you could not append an 8.3 file name.

Note that the shell and the file system may have different requirements. It may be possible to create a path with the API that the shell UI cannot handle.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/naming_a_file.asp
0
 
DevelopHerAuthor Commented:
The comment from DVation191 does not help me.  I have read it before (it was pasted here from another thread).  If the "\\?\" prefix is a possibility, I need to know HOW to implement this on an existing file system.  How, where, when do I use the "\\?\" prefix, if this is the answer?
0
 
DVation191Commented:
Well I didn't copy and paste from another thread...i got it right from the msdn article at the bottom of the post if it makes any difference.
Unfortunately I am not a programmer and have no idea how to use the Windows API to reference a path using the specified prefix. As far as I can tell, being that this functionality is part of the Windows API, it cannot be changed by any means in the Explorer gui.
It does state however, "It may be possible to create a path with the API that the shell UI cannot handle."...of course MS gave no reference to what that possibility might be...sorry DevelopHer
0
 
catknowsCommented:
Using the windows GUI, I don't think you would ever be able to create any filename whole length can be longer than 260 characters (path+filename altogether).

The answer is NO. For sure.  Unless Windows Explorer is rewritten with that capability, either by MS, a third party software or you yourself.
0
 
DVation191Commented:
Just because you didn't like the answer doesn't mean you should give somebody a "C". Even still, I mentioned the 260 character limit first, which means you accepted the wrong answer anyway.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now