macos - 在 OSX 中复制 bundle 时权限发生变化

标签 macos filesystems file-permissions

我有一个具有完全权限 (777) 的捆绑目录(包括子目录)

每当我使用 cp -r 将其复制到另一个目录时,我都会发现它失去了一些权限。

造成这种情况的原因是什么?如何在保持其权限不变的情况下移动此 bundle ?

我有 Lion 版本。

谢谢

最佳答案

使用-p标志:

cp -Rp whatever whereever

来自 cp 联机帮助页:

Cause cp to preserve the following attributes of each source file
in the copy: modification time, access time, file flags, file mode,
user ID, and group ID, as allowed by permissions.  Access Control
Lists (ACLs) and Extended Attributes (EAs), including resource
forks, will also be preserved.

If the user ID and group ID cannot be preserved, no error message
is displayed and the exit value is not altered.
If the source file has its set-user-ID bit on and the user ID can-
not be preserved, the set-user-ID bit is not preserved in the
copy's permissions.  If the source file has its set-group-ID bit on
and the group ID cannot be preserved, the set-group-ID bit is not
preserved in the copy's permissions.  If the source file has both
its set-user-ID and set-group-ID bits on, and either the user ID or
group ID cannot be preserved, neither the set-user-ID nor set-
group-ID bits are preserved in the copy's permissions.

关于macos - 在 OSX 中复制 bundle 时权限发生变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14921930/

相关文章:

linux - 软件 RAID 有什么特别之处可以带来更好的 IO 性能

c - 虚拟文件的文件大小

gradle - 为什么 Gradle Copy 任务会对目标目录中的所有内容进行快照?

c++ - Xcode 中的清屏

windows - 如何检查 excel 工作簿当前是否在 MAC 或 Windows 上工作

linux - 在 Linux 中,我如何找出哪个进程锁定了一个文件?

objective-c - 在包含多个 NSTextField 的窗口中捕获空格键

r - ld : warning: text-based stub file are out of sync. 回退到库文件进行链接

macos - 连接失败 : Native host has exited