Modified the delete directories method to delete the sub folders first.