This script can be used to clean up a directory tree irrespective of whether the directory tree contains
non-empty directories. As long as the user has permission to remove the files, this will work.
There is no files, thor cleaning a non-empty directory tree in python os module. os.removedirs() cannot be used to clean directories with non-empty sub-directories. I work on windows and many times in the week, need to copy and delete a big file system from the network to my machine.
If I perform deletion using Windows Explorer, it takes a long time and also pops up unnecessary dialogs. The python script did it about 60% faster than explorer and about 10% faster than MKS tool-kit's 'rm -rf' command.