I am looking out for a way in python for adding special permissions for the folders recursively in python, I can find them mostly on linux commands but not with python.
I need to change permission for the groups users to setguid for directories recursively .
This works with python-3.10.9:
import os;
import stat;
for dirname in ([x[0] for x in os.walk("root")]):
os.chmod(dirname, os.stat(dirname).st_mode | stat.S_ISGID);
Substitute "root"
with name of directory to start from.
I'm not experiensed with python, so maybe it is possible to simplify the code.