开发者

How to copy directory permissions

开发者 https://www.devze.com 2023-01-17 02:04 出处:网络
I\'m cur开发者_C百科ious how to copy the permission from directory to another. Any idea? Thanksshutil.copymode should help you out. From the documentation:

I'm cur开发者_C百科ious 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.


Since you mentionned python, I assume you are looking for

shutil.copymode(src, dst)

See the documentation on shutil


Try cp -a from_dir to_dir. It will maintain the permissions from the first directory.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号