os.removedirs - How to force this delete?

C

cstewart913

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?
 
M

Marc Christiansen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top