I didn't try renaming once I got the folders to delete, but I suspect you can also use other commands like ren or del to manipulate files as long as you use the extended path syntax all files involved in the operation. Although I'm having this issue with folders here, the same problem with extra spaces applies to files as well.
This article talks mainly about long file names, but it looks like that's basically the same issue of file names that the Classic Windows file APIs can't deal with. There's more info on the extended path syntax in the Microsoft Docs: The paths I use above still need to be fully qualified and must include the trailing spaces! To capture those trailing spaces I go into Explorer and copy the path from the address bar and paste it into the command line surrounded by quotes. The \\?\ relates to Extended Path Syntax that supports long filenames as well as apparently being more lax with spaces in path names. This does work: rd /s "\\?\C:\Web Sites\\faq " You have to use the extended path syntax that supports long paths and apparently various special cases like trailing spaces. Rather than using just a simple path like the following, which does not work: rd /s "C:\Web Sites\\faq " Use the following commands at your own risk. So be very, very careful and if possible run non-destructive commands like listings first before deleting files. The following commands will delete files on your system and you won't be able to restore them. Windows since version 7 has long path and extra characters in file names support via a special extended path syntax that uses a path-like prefix. The solution to deleting the files is to use the Windows Extended Path Format ( \\?\ path prefix) when deleting the folder from the command line. Deleting the Folders with Extended Path Format If an application creates filenames or nested paths that are longer than 256 chars long Explorer and most commands can't deal with those either using standard file operations.
This behavior is similar to files that have full paths longer than the old 256 char MAX_LENGTH. Renaming here by trimming the spaces just fails, as does trying to move the folder to a new location. Notice how the cursor in the folder edit textbox is way out to the right which is indicative of the extra spaces in the file name. The folder names include trailing spaces and this appears to throw off some of the older Windows APIs that return directory information. It turns out the issue is in my case is trailing spaces in the folder names. It looks like two different APIs being used - one that can deal with extended files and one that cannot.
Part of the confusion seems to be that some operations/applications can see the files and others can't, sometimes even inside of the same application - like seeing the file in Explorer and then not finding it trying to delete it.