-1

I think I found a bug in the filesystem and Windows doesn't seem to have a place to report bugs, so I will post it here in case anyone can enlighten me. First you should note that Windows File Explorer doesn't allow files to end with a . (dot).

  1. Create a random file, say a.txt
  2. Use cmd utility ren to rename file, you can do ren "a.txt" "a.txt../"

Now you have an inaccessible file a.txt..

I also reproduced it programmatically using MoveFile API function https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefile.

2 Answers2

2

This is not a bug (although there appear to be many articles wondering if it is a bug).

Please review this current Microsoft Document:

https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file

The content in this article is from 2020 (so reasonably current)

Relevant quote from the Article.

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"

A file ending in two dots (..) is just a dot inside the filename (permissible) and then ending in a dot (.) which is not permitted.

I certainly adhere to these specifications myself to avoid problems.

If you create files with non-permitted methods / characters, you can usually delete the files with Unlocker 1.92 (Metageek). I use Unlocker when I have a stubborn file that I do not want.

0

If it's not a bug, how am I supposed to get rid of this file? DeleteFile API doesn't work, del doesn't work

Is not accessible in Windows GUI, but your file can be deleted in the same interface where you create it, use your prompt/command line:

  • The del name.ext../ command don't work, try to delete with your file using *.* /P:
>ren "a.txt" "Bug.txt../"
>del  *.* /p

F:\2020-SU\Q1594381\bug.txt.., Delete (Y/N)? Y

For delete this files this options also works:

del bug.txt..?
del bug.txt^.^.?
del "\\?\%cd%\bug.txt..?"
del \\?\%cd%\bug.txt^.^.?

You can undo this:

ren  \\?\%cd%\bug.txt^.^.? a.txt

List file content..

type \\?\%cd%\bug.txt^.^.?


F:\2020-SU\Q1594189>del /?
Deletes one or more files.

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

names Specifies a list of one or more files or directories. Wildcards may be used to delete multiple files. If a directory is specified, all files within the directory will be deleted.

/P Prompts for confirmation before deleting each file. /F Force deleting of read-only files. /S Delete specified files from all subdirectories. /Q Quiet mode, do not ask if ok to delete on global wildcard /A Selects files to delete based on attributes attributes R Read-only files S System files H Hidden files A Files ready for archiving I Not content indexed Files L Reparse Points O Offline files - Prefix meaning not

If Command Extensions are enabled DEL and ERASE change as follows:

The display semantics of the /S switch are reversed in that it shows you only the files that are deleted, not the ones it could not find.

gronostaj
  • 58,482
Io-oI
  • 9,237