Skip to content

Instantly share code, notes, and snippets.

@whs
Created October 21, 2011 06:36
Show Gist options
  • Select an option

  • Save whs/1303245 to your computer and use it in GitHub Desktop.

Select an option

Save whs/1303245 to your computer and use it in GitHub Desktop.
chmodder
import commands, os,stat
c=commands.getoutput("find .")
c=c.split("\n")
#644
ro = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH
#775
rw = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH
for i in c:
#if i == ".": continue
if os.path.isfile(i):
print "%s: 644"%i
os.chmod(i, ro)
else:
print "%s: 775"%i
os.chmod(i, rw)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment