recursion - What is the Python way for recursively setting file permissions? -


What is the "Python way" to set the owner and group to files in the directory? I could just pass an order for a 'drunken-R' command, but I feel that I am not clear at all.

I am moving about:

  for Oswown (memo, 502, 20)  

For: oswalk (path ) In the root, diars, files for imported OS path = "/ tmp / foo" This directory works to set up, but fails when applied to files. I suspect that the files are not getting the full path, Therefore, the subscription fails because this file is not an error:

'OSError: [Aron 2] is not a file or directory:' foo.html '

M I see not here?

dirs and files root - that is, they are the basename () of the file / folders, that is, they do not contain / (or \ On the window). You need to get dirs / files for root if you want to work to the endless level of your code alternation: To get the whole path of your code:

 Ospath.join (root, memo), 502, 20) for files in memos: os.chown (os.path.join (root, memo), 502, 20)  < / Pre> 

I wonder if its functions are not functioning for the shutil module.


Comments