-1

It seems os.chmod(path, stat.S_IWSUR) only works for file. Is it a known bug? How can I chmod for a whole folder including its content?

Lillian
  • 70
  • 3
  • 11

1 Answers1

0

os.chmod is not intended to replicate all features of the chmod shell command; it's more like the chmod system call. Particularly, like the system call and unlike the shell command, it doesn't support a recursive chmod; you'd have to do that yourself with something like os.walk.

You can os.chmod a directory, but it won't chmod the directory's contents.

user2357112
  • 260,549
  • 28
  • 431
  • 505