Silly question: If you rename a file, Say: image.jpg to image.jpg.. it disappears.

Is this the way Windows handles deletes or something?


I remember in Windows XP it would simply disallow it as it is not supported. I believe it is a bug in Windows 7 this time around.

You can still recover your files easily using the command line by moving them elsewhere with the move command.


It's not a bug. Filenames in Win32 namespace are not allowed to contain dots at the end!!!

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".

Naming Files, Paths, and Namespaces

INFO: Filenames Ending with Space or Period Not Supported

CreateFile() removes trailing spaces and periods from file and directory names. This is done for compatibility with the FAT and HPFS file systems.

INFO: Filenames Ending with Space or Period Not Supported

Those trailing dots will be stripped off during the normalization phase when you pass a path 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 is fully POSIX-compatible and does support filenames with any characters except / and NUL. You just need to prepend 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

...

Because it turns off automatic expansion of the path string, the "\?" prefix also allows the use of ".." and "." in the path names, which can be useful if you are attempting to perform operations on a file with these otherwise reserved relative path specifiers as part of the fully qualified path.

Naming Files, Paths, and Namespaces