I've got a script that removes a directory and all its subdirectories. It works fine most of the times, but here is the problem:
Let's say I have the directory /car/ which has two subdirectories like this:
car/mercedes/
car/audi/
If I run the script to remove the car directory while I'm browsing the car directory with windows explorer, the script works perfectly. Now if I run the script while I'm browsing one of the subdirectories of car, it clears up all the content in car, but gives me a warning and does not remove the car directory alleging it is not empty (even though it now is). Here is the warning I get:
Warning: rmdir(../africa/mercedes): Directory not empty in C:\Inetpub... and so on
Any ideas on how to get around such a thing?
Cheers! 😃
EDIT: By the way, is there a way to retrieve files after they have been deleted by rmdir, like through the recycle bin or so?