Sign in with
Sign up | Sign in
Your question

Windows XP Directory and file name limits / maximums

Last response: in Windows XP
Share
Anonymous
September 14, 2005 4:03:02 AM

Archived from groups: microsoft.public.windowsxp.general (More info?)

Where would I find the Windows XP / NTFS directory and file name limits
documented ?

From what I understand :
- Directory name limit is 255 chars
- File name limit is 255 chars
- Directory and file name limit (when combined) is also 255 chars

Is this correct ?

Regards
Mike

More about : windows directory file limits maximums

Anonymous
September 14, 2005 10:05:41 PM

Archived from groups: microsoft.public.windowsxp.general (More info?)

No. Total is 260 with each part max of 255. This is not a NTFS limit. This is a limit on what most programs expect so on what most programs can work with. The total limit is around 32000 with each part a max of 255.

To access a 32000 char path use this syntax (the \\?\ is the part that says this is a 32000 character path).
\\?\c:\etc\etc\fname.ext

NTFS is the file system used by NT. They have their own limits (generally not specified by MS).

The NT OS runs other OSs (chkdsk at boot is an NT program (aka native mode) - the only one I think comes with windows - these aren't really documented either). Some of the OSs it runs are OS/2 text mode, Unix/Posix/Interenix, and Windows. Windows 16 bit and Dos programs are run in a Windows program that emulates dos/win16 although when OS/2 was included Dos programs used OS/2 not the Win16/Dos emulator.

Each of the above have different naming conventions. If a unix program saves a file using a legal unix name but an illegal Windows name then only unix stuff can access the file.

MS gives guidelines on naming. But they aren't the full specs but rules that allow Dos/Win16/Win9x, and WinNT programs (and OS/2 is closely related to Dos) to all access the file (unix is too different).

Here it is,
General rules for applications creating names for directories and files or processing names supplied by the user include the following:

a.. Use any character in the current code page for a name, but do not use a path separator, a character in the range 0 through 31, or any character explicitly disallowed by the file system. A name can contain characters in the extended character set (128–255).
b.. Use the backslash (\), the forward slash (/), or both to separate components in a path. No other character is acceptable as a path separator. Note that UNC names must adhere to the following format: \\server\share.
c.. Use a period (.) as a directory component in a path to represent the current directory.
d.. Use two consecutive periods (..) as a directory component in a path to represent the parent of the current directory.
e.. Use a period (.) to separate the base file name from the extension in a directory name or file name.
f.. Do not use the following characters in directory names or file names, because they are reserved:
< > : " / \ |

g.. Do not use device names, such as aux, con, lpt1, and prn, as file names or directory names.
h.. Process a path as a null-terminated string. The maximum length for a path, including a trailing backslash, is given by MAX_PATH.
The Unicode versions of several functions permit paths that exceed the MAX_PATH length if the path has the "\\?\" prefix. The "\\?\" tells the function to turn off path parsing. However, each component in the path cannot be more than MAX_PATH characters long. Use the "\\?\" prefix with paths for local storage devices and the "\\?\UNC\" prefix with paths having the Universal Naming Convention (UNC) format. The "\\?\" is ignored as part of the path. For example, "\\?\C:\myworld\private" is seen as "C:\myworld\private", and "\\?\UNC\bill_g_1\hotstuff\coolapps" is seen as "\\bill_g_1\hotstuff\coolapps".

i.. Do not assume case sensitivity. Consider names such as OSCAR, Oscar, and oscar to be the same.
j.. The following reserved words cannot be used as the name of a file: CON, PRN, AUX, CLOCK$, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also, reserved words followed by an extension—for example, NUL.tx7—are invalid file names.
By following the rules listed in this section, an application can create valid names for files and directories regardless of the file system in use.

Backslashes (\) are used as element dividers in paths (dividing the file name from the path to it, or directories from one another in a path). You cannot use them in file or directory names. They may be required as part of volume names (for example, "C:\").


--
--------------------------------------------------------------------------------------------------
http://webdiary.smh.com.au/archives/_comment/001075.htm...
=================================================
"ASGMikeG" <ASGMikeG@discussions.microsoft.com> wrote in message news:9BBF626D-1104-49C0-8437-5A3F046F44FA@microsoft.com...
> Where would I find the Windows XP / NTFS directory and file name limits
> documented ?
>
> From what I understand :
> - Directory name limit is 255 chars
> - File name limit is 255 chars
> - Directory and file name limit (when combined) is also 255 chars
>
> Is this correct ?
>
> Regards
> Mike
Anonymous
September 14, 2005 10:38:24 PM

Archived from groups: microsoft.public.windowsxp.general (More info?)

David,
Thank you for your incredibly detailed response - it answered my questions
and gave me a whole lot of extra background. Many Thanks !.

I don't suppose you have any references for this info ?

Regards
Michael Green

"David Candy" wrote:

> No. Total is 260 with each part max of 255. This is not a NTFS limit. This is a limit on what most programs expect so on what most programs can work with. The total limit is around 32000 with each part a max of 255.
>
> To access a 32000 char path use this syntax (the \\?\ is the part that says this is a 32000 character path).
> \\?\c:\etc\etc\fname.ext
>
> NTFS is the file system used by NT. They have their own limits (generally not specified by MS).
>
> The NT OS runs other OSs (chkdsk at boot is an NT program (aka native mode) - the only one I think comes with windows - these aren't really documented either). Some of the OSs it runs are OS/2 text mode, Unix/Posix/Interenix, and Windows. Windows 16 bit and Dos programs are run in a Windows program that emulates dos/win16 although when OS/2 was included Dos programs used OS/2 not the Win16/Dos emulator.
>
> Each of the above have different naming conventions. If a unix program saves a file using a legal unix name but an illegal Windows name then only unix stuff can access the file.
>
> MS gives guidelines on naming. But they aren't the full specs but rules that allow Dos/Win16/Win9x, and WinNT programs (and OS/2 is closely related to Dos) to all access the file (unix is too different).
>
> Here it is,
> General rules for applications creating names for directories and files or processing names supplied by the user include the following:
>
> a.. Use any character in the current code page for a name, but do not use a path separator, a character in the range 0 through 31, or any character explicitly disallowed by the file system. A name can contain characters in the extended character set (128–255).
> b.. Use the backslash (\), the forward slash (/), or both to separate components in a path. No other character is acceptable as a path separator. Note that UNC names must adhere to the following format: \\server\share.
> c.. Use a period (.) as a directory component in a path to represent the current directory.
> d.. Use two consecutive periods (..) as a directory component in a path to represent the parent of the current directory.
> e.. Use a period (.) to separate the base file name from the extension in a directory name or file name.
> f.. Do not use the following characters in directory names or file names, because they are reserved:
> < > : " / \ |
>
> g.. Do not use device names, such as aux, con, lpt1, and prn, as file names or directory names.
> h.. Process a path as a null-terminated string. The maximum length for a path, including a trailing backslash, is given by MAX_PATH.
> The Unicode versions of several functions permit paths that exceed the MAX_PATH length if the path has the "\\?\" prefix. The "\\?\" tells the function to turn off path parsing. However, each component in the path cannot be more than MAX_PATH characters long. Use the "\\?\" prefix with paths for local storage devices and the "\\?\UNC\" prefix with paths having the Universal Naming Convention (UNC) format. The "\\?\" is ignored as part of the path. For example, "\\?\C:\myworld\private" is seen as "C:\myworld\private", and "\\?\UNC\bill_g_1\hotstuff\coolapps" is seen as "\\bill_g_1\hotstuff\coolapps".
>
> i.. Do not assume case sensitivity. Consider names such as OSCAR, Oscar, and oscar to be the same.
> j.. The following reserved words cannot be used as the name of a file: CON, PRN, AUX, CLOCK$, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also, reserved words followed by an extension—for example, NUL.tx7—are invalid file names.
> By following the rules listed in this section, an application can create valid names for files and directories regardless of the file system in use.
>
> Backslashes (\) are used as element dividers in paths (dividing the file name from the path to it, or directories from one another in a path). You cannot use them in file or directory names. They may be required as part of volume names (for example, "C:\").
>
>
> --
> --------------------------------------------------------------------------------------------------
> http://webdiary.smh.com.au/archives/_comment/001075.htm...
> =================================================
> "ASGMikeG" <ASGMikeG@discussions.microsoft.com> wrote in message news:9BBF626D-1104-49C0-8437-5A3F046F44FA@microsoft.com...
> > Where would I find the Windows XP / NTFS directory and file name limits
> > documented ?
> >
> > From what I understand :
> > - Directory name limit is 255 chars
> > - File name limit is 255 chars
> > - Directory and file name limit (when combined) is also 255 chars
> >
> > Is this correct ?
> >
> > Regards
> > Mike
>
Anonymous
September 15, 2005 4:00:18 PM

Archived from groups: microsoft.public.windowsxp.general (More info?)

Search for a phrase in the docs I quoted. It is in the MSDN library but I use a CD version not the web version.

http://www.google.com.au/search?hl=en&q=%22Note+that+UN...

--
--------------------------------------------------------------------------------------------------
http://webdiary.smh.com.au/archives/_comment/001075.htm...
=================================================
"ASGMikeG" <ASGMikeG@discussions.microsoft.com> wrote in message news:26503432-D6C1-4370-873F-F83882A32F96@microsoft.com...
> David,
> Thank you for your incredibly detailed response - it answered my questions
> and gave me a whole lot of extra background. Many Thanks !.
>
> I don't suppose you have any references for this info ?
>
> Regards
> Michael Green
>
> "David Candy" wrote:
>
>> No. Total is 260 with each part max of 255. This is not a NTFS limit. This is a limit on what most programs expect so on what most programs can work with. The total limit is around 32000 with each part a max of 255.
>>
>> To access a 32000 char path use this syntax (the \\?\ is the part that says this is a 32000 character path).
>> \\?\c:\etc\etc\fname.ext
>>
>> NTFS is the file system used by NT. They have their own limits (generally not specified by MS).
>>
>> The NT OS runs other OSs (chkdsk at boot is an NT program (aka native mode) - the only one I think comes with windows - these aren't really documented either). Some of the OSs it runs are OS/2 text mode, Unix/Posix/Interenix, and Windows. Windows 16 bit and Dos programs are run in a Windows program that emulates dos/win16 although when OS/2 was included Dos programs used OS/2 not the Win16/Dos emulator.
>>
>> Each of the above have different naming conventions. If a unix program saves a file using a legal unix name but an illegal Windows name then only unix stuff can access the file.
>>
>> MS gives guidelines on naming. But they aren't the full specs but rules that allow Dos/Win16/Win9x, and WinNT programs (and OS/2 is closely related to Dos) to all access the file (unix is too different).
>>
>> Here it is,
>> General rules for applications creating names for directories and files or processing names supplied by the user include the following:
>>
>> a.. Use any character in the current code page for a name, but do not use a path separator, a character in the range 0 through 31, or any character explicitly disallowed by the file system. A name can contain characters in the extended character set (128–255).
>> b.. Use the backslash (\), the forward slash (/), or both to separate components in a path. No other character is acceptable as a path separator. Note that UNC names must adhere to the following format: \\server\share.
>> c.. Use a period (.) as a directory component in a path to represent the current directory.
>> d.. Use two consecutive periods (..) as a directory component in a path to represent the parent of the current directory.
>> e.. Use a period (.) to separate the base file name from the extension in a directory name or file name.
>> f.. Do not use the following characters in directory names or file names, because they are reserved:
>> < > : " / \ |
>>
>> g.. Do not use device names, such as aux, con, lpt1, and prn, as file names or directory names.
>> h.. Process a path as a null-terminated string. The maximum length for a path, including a trailing backslash, is given by MAX_PATH.
>> The Unicode versions of several functions permit paths that exceed the MAX_PATH length if the path has the "\\?\" prefix. The "\\?\" tells the function to turn off path parsing. However, each component in the path cannot be more than MAX_PATH characters long. Use the "\\?\" prefix with paths for local storage devices and the "\\?\UNC\" prefix with paths having the Universal Naming Convention (UNC) format. The "\\?\" is ignored as part of the path. For example, "\\?\C:\myworld\private" is seen as "C:\myworld\private", and "\\?\UNC\bill_g_1\hotstuff\coolapps" is seen as "\\bill_g_1\hotstuff\coolapps".
>>
>> i.. Do not assume case sensitivity. Consider names such as OSCAR, Oscar, and oscar to be the same.
>> j.. The following reserved words cannot be used as the name of a file: CON, PRN, AUX, CLOCK$, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also, reserved words followed by an extension—for example, NUL.tx7—are invalid file names.
>> By following the rules listed in this section, an application can create valid names for files and directories regardless of the file system in use.
>>
>> Backslashes (\) are used as element dividers in paths (dividing the file name from the path to it, or directories from one another in a path). You cannot use them in file or directory names. They may be required as part of volume names (for example, "C:\").
>>
>>
>> --
>> --------------------------------------------------------------------------------------------------
>> http://webdiary.smh.com.au/archives/_comment/001075.htm...
>> =================================================
>> "ASGMikeG" <ASGMikeG@discussions.microsoft.com> wrote in message news:9BBF626D-1104-49C0-8437-5A3F046F44FA@microsoft.com...
>> > Where would I find the Windows XP / NTFS directory and file name limits
>> > documented ?
>> >
>> > From what I understand :
>> > - Directory name limit is 255 chars
>> > - File name limit is 255 chars
>> > - Directory and file name limit (when combined) is also 255 chars
>> >
>> > Is this correct ?
>> >
>> > Regards
>> > Mike
>>
Related resources
!