Today I ran into a problem where I needed to delete a folder structure which was setup incorrectly. Because of this the folder had a huge amount of empty subfolders.
Ok, no problem.. just select the root folder, and select DELETE.
WRONG, it didn’t delete but it presented me with this error:
So I tried to delete the folder through the command line using RMDIR /S /Q and Deltree, but this also didn’t work.
Ok, what now. I use robocopy a lot for copying / moving files around so I tried to mis-use this command to delete the folders.
- First I created an empty folder next to the root folder.
- Then I ran the following syntax:
- robocopy “empty folder” “root folder” /MIR
By using the /MIR option it will delete all files /folders in the destination that do not exist in the source (mirrors the contents). It took some time (several hours), but afterwards the folder was deleted.