Skip to main content
added 73 characters in body
Source Link
phuclv
  • 28.4k
  • 15
  • 128
  • 252

No. A single dot means the current directory and 2 dots mean the parent directory, just like on *nix

  • Use a period as a directory component in a path to represent the current directory, for example ".\temp.txt". For more information, see Paths.
  • Use two consecutive periods (..) as a directory component in a path to represent the parent of the current directory, for example "..\temp.txt". For more information, see Paths.
 

Naming Files, Paths, and Namespaces

In fact a more general rule is that no file can end with a dot in Windows

Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not. However, it is acceptable to specify a period as the first character of a name. For example, ".temp".

See

The reason is because they'll be normalized when passing to Win32 APIs

Some characters will be removed (other than runs of separators and relative segments).

 

If a segment ends in a single period, that period will be removed. A segment of a single or double period falls under the relative component rule above. A segment of three periods (or more) doesn't hit any of these rules and is actually a valid file/directory name.

 

If the path doesn't end in a separator, all trailing periods and spaces (charater [sic] code 32 only) will be removed. If the last segment is simply a single or double period it falls under the relative components rule above. This rule leads to the possibly surprising ability to create a directory with a trailing space. You simply need to add a trailing separator to do so.

 

Path Normalization

That doesn't mean that those files can't be created though, because NTFS namespace is fully POSIX-compatible. You just need to append the \\?\ prefix to disable file name normalization

For file I/O, the "\?" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system

 

Naming Files, Paths, and Namespaces

See also

No. A single dot means the current directory and 2 dots mean the parent directory, just like on *nix

  • Use a period as a directory component in a path to represent the current directory, for example ".\temp.txt". For more information, see Paths.
  • Use two consecutive periods (..) as a directory component in a path to represent the parent of the current directory, for example "..\temp.txt". For more information, see Paths.
 

Naming Files, Paths, and Namespaces

In fact a more general rule is that no file can end with a dot in Windows

Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not. However, it is acceptable to specify a period as the first character of a name. For example, ".temp".

See

The reason is because they'll be normalized when passing to Win32 APIs

Some characters will be removed (other than runs of separators and relative segments).

 

If a segment ends in a single period, that period will be removed. A segment of a single or double period falls under the relative component rule above. A segment of three periods (or more) doesn't hit any of these rules and is actually a valid file/directory name.

 

If the path doesn't end in a separator, all trailing periods and spaces (charater code 32 only) will be removed. If the last segment is simply a single or double period it falls under the relative components rule above. This rule leads to the possibly surprising ability to create a directory with a trailing space. You simply need to add a trailing separator to do so.

 

Path Normalization

That doesn't mean that those files can't be created though, because NTFS namespace is fully POSIX-compatible. You just need to append the \\?\ prefix to disable file name normalization

For file I/O, the "\?" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system

 

Naming Files, Paths, and Namespaces

See also

No. A single dot means the current directory and 2 dots mean the parent directory, just like on *nix

  • Use a period as a directory component in a path to represent the current directory, for example ".\temp.txt". For more information, see Paths.
  • Use two consecutive periods (..) as a directory component in a path to represent the parent of the current directory, for example "..\temp.txt". For more information, see Paths.

Naming Files, Paths, and Namespaces

In fact a more general rule is that no file can end with a dot in Windows

Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not. However, it is acceptable to specify a period as the first character of a name. For example, ".temp".

See

The reason is because they'll be normalized when passing to Win32 APIs

Some characters will be removed (other than runs of separators and relative segments).

If a segment ends in a single period, that period will be removed. A segment of a single or double period falls under the relative component rule above. A segment of three periods (or more) doesn't hit any of these rules and is actually a valid file/directory name.

If the path doesn't end in a separator, all trailing periods and spaces (charater [sic] code 32 only) will be removed. If the last segment is simply a single or double period it falls under the relative components rule above. This rule leads to the possibly surprising ability to create a directory with a trailing space. You simply need to add a trailing separator to do so.

Path Normalization

That doesn't mean that those files can't be created though, because NTFS namespace is fully POSIX-compatible. You just need to append the \\?\ prefix to disable file name normalization

For file I/O, the "\?" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system

Naming Files, Paths, and Namespaces

See also

added 1475 characters in body
Source Link
phuclv
  • 28.4k
  • 15
  • 128
  • 252

No. A single dot means the current directory and 2 dots mean the parent directory, just like on *nix

  • Use a period as a directory component in a path to represent the current directory, for example ".\temp.txt". For more information, see Paths.
  • Use two consecutive periods (..) as a directory component in a path to represent the parent of the current directory, for example "..\temp.txt". For more information, see Paths.

Naming Files, Paths, and Namespaces

In fact a more general rule is that no file can end with a dot in Windowsno file can end with a dot in Windows

Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not. However, it is acceptable to specify a period as the first character of a name. For example, ".temp".

See

The reason is because they'll be normalized when passing to Win32 APIs

Some characters will be removed (other than runs of separators and relative segments).

If a segment ends in a single period, that period will be removed. A segment of a single or double period falls under the relative component rule above. A segment of three periods (or more) doesn't hit any of these rules and is actually a valid file/directory name.

If the path doesn't end in a separator, all trailing periods and spaces (charater code 32 only) will be removed. If the last segment is simply a single or double period it falls under the relative components rule above. This rule leads to the possibly surprising ability to create a directory with a trailing space. You simply need to add a trailing separator to do so.

Path Normalization

That doesn't mean that those files can't be created though, because NTFS namespace is fully POSIX-compatible. You just need to append the \\?\ prefix to disable file name normalization

For file I/O, the "\?" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system

Naming Files, Paths, and Namespaces

See also

No. A single dot means the current directory and 2 dots mean the parent directory, just like on *nix

  • Use a period as a directory component in a path to represent the current directory, for example ".\temp.txt". For more information, see Paths.
  • Use two consecutive periods (..) as a directory component in a path to represent the parent of the current directory, for example "..\temp.txt". For more information, see Paths.

Naming Files, Paths, and Namespaces

In fact a more general rule is that no file can end with a dot in Windows

Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not. However, it is acceptable to specify a period as the first character of a name. For example, ".temp".

See also

No. A single dot means the current directory and 2 dots mean the parent directory, just like on *nix

  • Use a period as a directory component in a path to represent the current directory, for example ".\temp.txt". For more information, see Paths.
  • Use two consecutive periods (..) as a directory component in a path to represent the parent of the current directory, for example "..\temp.txt". For more information, see Paths.

Naming Files, Paths, and Namespaces

In fact a more general rule is that no file can end with a dot in Windows

Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not. However, it is acceptable to specify a period as the first character of a name. For example, ".temp".

See

The reason is because they'll be normalized when passing to Win32 APIs

Some characters will be removed (other than runs of separators and relative segments).

If a segment ends in a single period, that period will be removed. A segment of a single or double period falls under the relative component rule above. A segment of three periods (or more) doesn't hit any of these rules and is actually a valid file/directory name.

If the path doesn't end in a separator, all trailing periods and spaces (charater code 32 only) will be removed. If the last segment is simply a single or double period it falls under the relative components rule above. This rule leads to the possibly surprising ability to create a directory with a trailing space. You simply need to add a trailing separator to do so.

Path Normalization

That doesn't mean that those files can't be created though, because NTFS namespace is fully POSIX-compatible. You just need to append the \\?\ prefix to disable file name normalization

For file I/O, the "\?" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system

Naming Files, Paths, and Namespaces

See also

Source Link
phuclv
  • 28.4k
  • 15
  • 128
  • 252

No. A single dot means the current directory and 2 dots mean the parent directory, just like on *nix

  • Use a period as a directory component in a path to represent the current directory, for example ".\temp.txt". For more information, see Paths.
  • Use two consecutive periods (..) as a directory component in a path to represent the parent of the current directory, for example "..\temp.txt". For more information, see Paths.

Naming Files, Paths, and Namespaces

In fact a more general rule is that no file can end with a dot in Windows

Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not. However, it is acceptable to specify a period as the first character of a name. For example, ".temp".

See also