flybywire flybywire - 1 year ago 181
Python Question

python: delete non-empty dir

How do I delete a possibly non-empty dir in Python.

The directory may have nested subdirectories many levels deep.

Answer Source

Use shutil.rmtree:

import shutil


See the documentation for details of how to handle and/or ignore errors.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download