It's likely, as Phaelax suggested, that you cannot remove a directory until it is empty of all files. I would guess that DBC is calling the function
RemoveDirectory from the win32 API which specifically requires the directory to be empty. It forces you to manage your cleanup manually (hopefully reducing instances of "Whoop, I just deleted everything!"). So as a rule of thumb, try:
1. Make sure any files you wish to delete are closed
2. Delete all the files in the directory first
3. If there are subdirectories you'll have to open them, delete the files and delete them as well.
3b . and .. should remain
4. Make sure the Folder to be deleted is empty and closed
5. Delete the directory
As DBC was designed for game making, the file commands are available with the thought that you would be managing games files and directories (which would be relatively smaller and easier to manage than the user's entire volume set).
A variation of of the DOS code that might work is
path$=some directory to delete
cm$="/c rmdir /s /q "+chr$(34)+path$+chr$(34)
execute file "command","cm$","",1
Maybe everyone should keep deleteing files and folders out of the DBC challenges when all of the volumes on a computer are being accessed.
Enjoy your day.