1
2 import os
3 import stat
4 import shutil
5 def del_ro_dir(dir_name):
6 '''Remove Read Only Directories'''
7 for (root, dirs, files) in os.walk(dir_name, topdown=True):
8 os.chmod(root,
9 # For user ...
10 stat.S_IRUSR |
11 stat.S_IWUSR |
12 stat.S_IXUSR |
13 # For group ...
14 stat.S_IWGRP |
15 stat.S_IRGRP |
16 stat.S_IXGRP |
17 # For other ...
18 stat.S_IROTH |
19 stat.S_IWOTH |
20 stat.S_IXOTH
21 )
22 shutil.rmtree(dir_name)
23
24 if __name__ == '__main__':
25 del_ro_dir('')
26