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.
Thanks for your report!
For reference, here are the relevant sections from the documentation:
- https://docs.python.org/3/library/shutil.html?highlight=rmtree#shutil.rmtree
- https://docs.python.org/3/library/os.html?highlight=removedirs#os.removedirs
It looks to me that
removedirs
can be implemented by callingrmtree
on the top-level directory withignore_errors=True
. Do you agree?This doesn't add the functionality of accepting path-like objects though. This is the subject of ticket #119.
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:
- It also removes non-empty folders
- It tries to remove the whole path and not partially some sub directories.
- 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!