Windows: Delete Folder with a trailing Space Character

Recently, I had the problem that a Robocopy script created folder with a space character at the end on the Windows NTFS file system. So for example

"FolderName "

In File Explorer, I could not delete the folder, the error message said "Object does not exist". Also renaming the folder was not possible.

The onyl solution was to go to a CMD box and issue the command

rd /s "\\?\D:\bad\folder\path "

Just answer "y* when you are asked if you really want to delete the folder.

Leave a Reply

Your email address will not be published.