[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 1694 - trunk/subversion/tests/clients/cmdline/svntest

From: Branko Čibej <brane_at_xbc.nu>
Date: 2002-04-15 18:28:07 CEST

Sander Striker wrote:

>
>PS. Would something like this work to recursively set perms?
>
>def relax_perms(dir):
> "Recursively set the perms to be very relaxed."
>
> mode = os.stat(dir)[ST_MODE]
> os.chmod(dir, S_IMODE(mode) | 0022)
>
> for path in os.listdir(dir):
> pathname = '%s/%s' % (dir, path)
> mode = os.stat(pathname)[ST_MODE]
> if S_ISDIR(mode):
> # It's a directory, recurse into it
> relax_perms(pathname)
> elif S_ISREG(mode):
> # It's a file, set its perms
> os.chmod(pathname, S_IMODE(mode) | 0022)
>
What you're looking for is os.path.walk, os.path.isdir, os.path.isfile, ...

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Apr 15 18:29:34 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.