How to delete a folder containing trailing spaces
Solution 1:
First try some quoting:
rd "my folder "
Then UNC paths:
rd "\\.\C:\temp\my folder "
Then try adding a trailing [back]slash:
rd "my folder \"
rd "\\.\C:\temp\my folder \"
Then 8.3 names (if they are enabled on your system):
rd myfold~1
Then a Linux LiveCD:
rmdir "/media/blahblah/temp/my folder "
Solution 2:
I had the same problem, in Windows 7 x64, and none of the command-line solutions worked here.
What fixed it for me:
- Rename the folder using 7-Zip
- Delete, either using 7-Zip or Explorer (both work)
Note that deleting the folder in 7-Zip before renaming it was impossible.
Solution 3:
windows 7
I was having issues getting rid of a folder.
"C:\Users\Rob\Desktop\Music\ A k o n "
This is what finally worked for me: I opened up the cmd prompt in the Music folder (shift right click, open command window here)
then typed in the following command
rd " A k o n \"
notice the back slash.
beginning spaces and trailing spaces really mess crap up. I spent at least 2 hours searching for a solution.
Thank you grawity for posting the solution.