471,330 Members | 1,851 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

os.removedirs - How to force this delete?

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?

Sep 27 '07 #1
1 7561
cs*********@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
Sep 27 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Golawala, Moiz M (GE Infrastructure) | last post: by
1 post views Thread by Douglas Peterson | last post: by
9 posts views Thread by learning | last post: by
1 post views Thread by Randy | last post: by
4 posts views Thread by Hong Chen | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.