Hey,
I'm curious how to copy the permission from directory to another. Any idea?
Thanks
Hey,
I'm curious how to copy the permission from directory to another. Any idea?
Thanks
shutil.copymode
should help you out. From the documentation:
shutil.copymode(src, dst)
Copy the permission bits from src to dst. The file contents, owner, and group are unaffected. src and dst are path names given as strings.
I tested this in Ubuntu Jaunty using Python 2.6.2 and it worked for me.
Try cp -a from_dir to_dir. It will maintain the permissions from the first directory.