[Python-Dev] Extending os.chown() to accept user/group names

Tim Delaney timothy.c.delaney at gmail.com
Thu May 26 00:10:29 CEST 2011


2011/5/26 Victor Stinner <victor.stinner at haypocalc.com>

> Le mercredi 25 mai 2011 à 18:46 +0200, Charles-François Natali a écrit :
> > While we're at it, adding a "recursive" argument to this shutil.chown
> > could also be useful.
>
> I don't like the idea of a recursive flag. I would prefer a "map-like"
> function to "apply" a function on all files of a directory. Something
> like shutil.apply_recursive(shutil.chown)...
>
> ... maybe with options to choose between deep-first search and
> breadth-first search, filter (filenames, file size, files only,
> directories only, other attributes?), directory before files (may be
> need for chmod(0o000)), etc.


Pass an iterable to shutil.chown()? Then you could call it like:

shutil.chown(os.walk(path))

Then of course you have the difficulty of wanting to pass either an iterator
or a single path - probably prefer two functions e.g.:

shutil.chown(path)
shutil.chown_many(iter)

Tim Delaney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110526/658c4dc7/attachment-0001.html>


More information about the Python-Dev mailing list