Windows and its API is sometimes just funny. You can create directories (AKA “folders”) with API calls that neither Windows Explorer nor a normal DEL or RD can delete.
For example, you can create a directory that ends with a space (“ “) using CreateDirectory. However, trying to delete this directory with Windows Explorer or a Command Prompt will result in “Windows can not find XXX”:
The solution to delete this “undeletable” directories: Use the MS-DOS 8+3 Names!
First, use dir /x to retrieve the 8+3 names for the directory, and then type RD [8+3 DirName] to remove the folder.
It’s that simple.