os.removedirs - How to force this delete?

Marc Christiansen usenet at solar-empire.de
Thu Sep 27 11:33:03 EDT 2007


cstewart913 at gmail.com wrote:
> I've been searching to find a way to force this delete to work even if
> the directory isn't empty.  I've had no luck thus far.  Anyone know
> what that would be?

Answering your immediate question: you can't force os.removedirs to
delete non-empty dirs.
But shutil.rmtree(path, ignore_errors=True) does what you want.

HTH, Marc



More information about the Python-list mailing list