Recursively Set All Files And Folders To 777 From This List
I've tried endlessly searching for a solution to this, but couldn't seem to find out. I have a list of paths: dirToModify = ['includes/','misc/','modules/','scripts/','themes/'] I
Solution 1:
You can iterate through the directories you'd like to modify, then use os.walk
to iterate over all of the directories and files in each of these directories, like so:
for your_dir in dirs_to_modify:
for root, dirs, files in os.walk(your_dir):
for d in dirs:
os.chmod(os.path.join(root, d), 0o777)
for f in files:
os.chmod(os.path.join(root, f), 0o777)
Post a Comment for "Recursively Set All Files And Folders To 777 From This List"