Return to Snippet

Revision: 39885
at January 22, 2011 04:12 by silviud


Initial Code
def _chown(path, uid, gid):
        os.chown(path, uid, gid)
        for item in os.listdir(path):
            itempath = os.path.join(path, item)
            if os.path.isfile(itempath):
                os.chown(itempath, uid, gid)
            elif os.path.isdir(itempath):
                os.chown(itempath, uid, gid)
                self._chown(itempath, uid, gid)

Initial URL


Initial Description
as you run chown -R user:group dir

Initial Title
Python recursive change uid and gid (chown) of directory

Initial Tags
python, unix, linux

Initial Language
Python