Adding recursive support in os.chmod/os.chown/shutil.chown

Hey,
Using the chmod/chown functions I realized Python does not have support for doing it recursively when it’s a directory.

You can walk through the directories of course, but in the spirit of other functions we have in shutil, I feel like it would be pretty simple to add, so someone converting a system call (chown -R etc…) in a python script can do it with a single function call.

Was this proposed before and rejected? I can’t find any precedence.

Cheers
Tarek

5 Likes

Looks sensible and straightforward, I’d probably use it (even if I’m more into getfacl and setfacl these times, and they’re not in stdlib).

:wave:

F

i would assume people are mostly using 3rd party libs lik sh to have a lot of flexibility using system utils like this, but on the other hand, if we have them in the stdlib, and they are making the 90% you need most of the time, it’s even better, and for that i see no reason not to have the recursive flag which is a very common usecase, having to resort to os.walk is not just boilerplate but also another opportunity to introduce bugs, as it’s not the most trivial function to use.