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

user1000
  • 1
  • 1
  • 1
    [Microsoft absolutely has a place to provide feedback like this.](https://www.howtogeek.com/368667/how-to-report-a-problem-or-send-feedback-about-windows-10/#:~:text=How%20to%20Report%20a%20Problem%20or%20Send%20Feedback,report%20a%20problem.%20...%203%20Submitting%20Feedback.%20) – Ramhound Oct 14 '20 at 23:45

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.

John
  • 46,167
  • 4
  • 33
  • 54
  • 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 – user1000 Oct 15 '20 at 00:14
  • Use Unlocker 1.92 (Metageek) to delete troublesome files. Also, you can make files with non-permitted methods but the results can be unpredictable as you see here. I amended my answer to include this piece. – John Oct 15 '20 at 00:16
  • I didn't like the idea of installing another program just to fix this, but I found out that `rm` from WSL or git for windows works – user1000 Oct 15 '20 at 00:44
  • I accepted your answer, though personally I still consider this a bug xD – user1000 Oct 15 '20 at 00:54
  • RM from GitHub can work. There is more than one way to do this. I keep Unlocker on hand for other errant Adobe and Windows files that will not delete normally. Like I said, more than one way to do things. – John Oct 15 '20 at 01:16
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
  • 55,965
  • 20
  • 120
  • 179
Io-oI
  • 7,588
  • 3
  • 12
  • 41