projects
/
mdk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3d019c2
)
Function to recursively chmod a directory
author
Frederic Massart
<fred@moodle.com>
Fri, 10 Aug 2012 06:41:52 +0000
(14:41 +0800)
committer
Frederic Massart
<fred@moodle.com>
Fri, 10 Aug 2012 06:41:52 +0000
(14:41 +0800)
lib/tools.py
patch
|
blob
|
history
diff --git
a/lib/tools.py
b/lib/tools.py
index
039a7a0
..
fef1909
100644
(file)
--- a/
lib/tools.py
+++ b/
lib/tools.py
@@
-2,6
+2,7
@@
# -*- coding: utf-8 -*-
import sys
+import os
import subprocess, shlex
import re
@@
-14,6
+15,16
@@
def yesOrNo(q):
elif i == 'n':
return False
+def chmodRecursive(path, chmod):
+ os.chmod(path, chmod)
+ for (dirpath, dirnames, filenames) in os.walk(path):
+ for d in dirnames:
+ dir = os.path.join(dirpath, d)
+ os.chmod(dir, chmod)
+ for f in filenames:
+ file = os.path.join(dirpath, f)
+ os.chmod(file, chmod)
+
def debug(str):
print str
sys.stdout.flush()