Created
September 13, 2013 12:57
-
-
Save tlatsas/6550333 to your computer and use it in GitHub Desktop.
chmod -R in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
def rchmod(path, dmode, fmode): | |
for root, dirs, files in os.walk(path): | |
for _dir in dirs: | |
os.chmod(os.path.join(root, _dir), dmode) | |
for _file in files: | |
os.chmod(os.path.join(root, _file), fmode) | |
if __name__ == "__main__": | |
path = "/tmp/some/stuff" | |
fmode = dmode = 0o777 | |
rchmod(path, dmode, fmode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment