Deleting Files Ending With a Period

I once made the very unfortunate mistake of renaming a file and then accidentally saving the change while I was halfway through making the change, right on the period before the extension. What happened then? Well, I became unable to delete or rename said file, forcing me to leave it untouched for months, bothering the back of my mind. (You might have gotten a file with a period at the end of the filename from another operating system, or sometimes unarchiving a RAR or ZIP with a bad filename will make this happen.)

When trying to delete or rename the file, you will be prompted with the following error:

Error Deleting File or Folder – Cannot delete file: Cannot read from the source file or disk

Why can’t you delete it? Windows considers filenames ending with a period invalid, and therefore lists it in Explorer, but is unable to manipulate the file whatsoever.

However, you can utilize long paths to circumvent this behavior.

If you’re trying to delete a file:
del "\\?\C:\Users\User\Downloads\Filename."

If you’re trying to delete a folder:
rd /s "\\?\C:\Users\User\Downloads\Foldername."

Leave a Reply