[Python-ideas] Add shutil.chown(..., recursive=False)

Giampaolo Rodola' g.rodola at gmail.com
Mon May 28 16:23:03 EDT 2018


...as in (not tested):

    def _rchown(dir, user, group):
        for root, dirs, files in os.walk(dir, topdown=False):
            for name in files:
                chown(os.path.join(root, name), user, group)

    def chown(path, user=None, group=None, recursive=False):
        if recursive and os.path.isdir(path):
            _rchown(dir, user, group)
        ...

It appears like a common enough use case to me ("chown -R path").
Thoughts?

-- 
Giampaolo - http://grodola.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180528/d87b75c3/attachment.html>


More information about the Python-ideas mailing list