我正在将内容从我的 Windows XP 机器同步到 OS X Lion 机器,但有些文件夹具有错误的权限。
> rsync -rtvz --del "/cygdrive/c/rsync_20101220/" "agrimm@[redacted]:'/Users/agrimm/external/daiichi/Top level files/rsync_20101220'"
[lot of listing of files skipped. More logging than buffer, so I don't know if any logging messages were lost]
sent 2439672264 bytes received 1444272 bytes 795800.01 bytes/sec
total size is 22869261932 speedup is 9.37
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1042) [sender=3.0.7]
在 OS X 机器上,这是我获得的权限:
~ agrimm$ cd external/daiichi/
daiichi agrimm$ ls -ltra
total 0
drwxr-xr-x 6 agrimm staff 204 Aug 24 2011 Thunderbird
drwxr-xr-x 6 agrimm staff 204 Jul 4 09:21 FinePrint files
drwxr-xr-x 4 agrimm staff 136 Jul 10 13:10 ..
drwxr-xr-x 17 agrimm staff 578 Jul 11 10:50 Desktop
drwxr-xr-x 6 agrimm staff 204 Jul 11 11:22 .
drwxr-xr-x 3 agrimm staff 102 Jul 11 11:25 Top level files
daiichi agrimm$ cd Top\ level\ files/
Top level files agrimm$ ls -ltra
total 0
drwxr-xr-x 5 agrimm staff 170 Aug 18 2011 rsync_20101220
drwxr-xr-x 6 agrimm staff 204 Jul 11 11:22 ..
drwxr-xr-x 3 agrimm staff 102 Jul 11 11:25 .
Top level files agrimm$ cd rsync_20101220/
rsync_20101220 agrimm$ ls -ltra
total 0
d-wx------ 4 agrimm staff 136 Dec 4 2009 Desktop
d-wx------ 13 agrimm staff 442 Apr 5 2011 gitrepos
drwxr-xr-x 5 agrimm staff 170 Aug 18 2011 .
drwx------ 7 agrimm staff 238 Aug 18 2011 code
drwxr-xr-x 3 agrimm staff 102 Jul 11 11:25 ..
rsync_20101220 agrimm$ ls Desktop/
ls: : Permission denied
rsync_20101220 agrimm$ ls gitrepos/
ls: : Permission denied
rsync_20101220 agrimm$ ls -ltr code/
total 0
d-wx------ 3 agrimm staff 102 Jan 20 2010 temporary_development
d-wx------ 3 agrimm staff 102 Dec 2 2010 merging
d-wx------ 3 agrimm staff 102 Dec 21 2010 inactive
d-wx------ 5 agrimm staff 170 Jul 4 2011 sandbox
d-wx------ 19 agrimm staff 646 Aug 24 2011 hiv_recombination
rsync_20101220 agrimm$ ls -R code/
hiv_recombination inactive merging sandbox temporary_development
code//hiv_recombination:
ls: hiv_recombination: Permission denied
code//inactive:
ls: inactive: Permission denied
code//merging:
ls: merging: Permission denied
code//sandbox:
ls: sandbox: Permission denied
code//temporary_development:
ls: temporary_development: Permission denied
rsync_20101220 agrimm$
文件的权限和用户在 Windows 上看起来一致。在 git bash 中:
A.Grimm@AGRIMM-MED /c/rsync_20101220
$ ls -ltra
total 0
drwxr-xr-x 2 A.Grimm Administ 0 Dec 4 2009 Desktop
drwxr-xr-x 13 A.Grimm Administ 0 Apr 5 2011 gitrepos
drwxr-xr-x 5 A.Grimm Administ 0 Aug 18 2011 .
drwxr-xr-x 7 A.Grimm Administ 0 Aug 18 2011 code
drwxr-xr-x 26 A.Grimm Administ 0 Jul 11 12:55 ..
为什么在某些情况下权限错误,但在其他情况下却正确?我是否应该删除 OS X 机器上的“rsync_20101220”,然后在 rsync 命令中添加 -p 再次执行此操作?
答案1
我没有找到-p
解决办法。相反,我手动创建了问题目录的空版本,然后进行了 rsync。