How to delete a non-empty folder in Python

Deleting a non-empty folder deletes the folder along with all of its files and subdirectories.

Solution for How to delete a non-empty folder in Python : You can use shutil.rmtree() to delete a non-empty folder Call shutil.rmtree(path) to delete the folder specified by path.

rmtree(path) fails if the folder contains read-only files. To ignore this restriction, set ignore_errors to True.

Directory Listing


how-to-delete-a-non-empty-folder-in-python