开发者

How to copy directory permissions

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜