Opened 3 years ago

Last modified 3 years ago

#125 new enhancement

Add support for removedirs function

Reported by: ftputiluser Owned by: schwa
Priority: minor Milestone:
Component: Library Version:
Keywords: Cc:


As makedirs() is implemented it sounds reasonable to also implement the related removedirs() function. rmtree() seems to be in place as an alternative but if I'm not mistaken the result is slightly different.

Change History (2)

comment:1 Changed 3 years ago by schwa

Thanks for your report!

For reference, here are the relevant sections from the documentation:

It looks to me that removedirs can be implemented by calling rmtree on the top-level directory with ignore_errors=True. Do you agree?

This doesn't add the functionality of accepting path-like objects though. This is the subject of ticket #119.

comment:2 Changed 3 years ago by ftputiluser

Thanks for adding the relevant links, I should have done that myself...

I'm no expert on python or in those functions but judging from the documentation I would assume that rmtree differs in the following way:

  1. It also removes non-empty folders
  2. It tries to remove the whole path and not partially some sub directories.
  3. Exceptions were different and thrown in different cases I believe

I can be wrong in some or all points but that needs to be checked :)

Thanks for your great work!

Last edited 3 years ago by ftputiluser (previous) (diff)
Note: See TracTickets for help on using tickets.