我用它ssh
来连接远程机器。在我的主目录中,我创建了一个指向已安装目录的符号链接,如下所示:
username@hostname:~$ ls -l
lrwxrwxrwx 1 username users 69 Jan 21 09:09 mysymlink -> /media/some/mounted/target/directory/
如果我尝试rsync
在主机上运行以下命令,它不会解析目标路径中的符号链接,而是想要创建该目录,而不是按照链接到现有目录:
~$ rsync -av --progress /home/bytecommander/EclipseProjects -e ssh username@hostname:/home/username/mysymlink
username@hostname's password:
sending incremental file list
EclipseProjects/
rsync: recv_generator: mkdir "/home/username/mysymlink/EclipseProjects" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
sent 36,368 bytes received 2,451 bytes 15,527.60 bytes/sec
total size is 39,039,765 speedup is 1,005.69
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1]
我已经尝试将以下选项逐个添加到rsync
,但没有任何成功:
-l, --links copy symlinks as symlinks
-L, --copy-links transform symlink into referent file/dir
--copy-unsafe-links only "unsafe" symlinks are transformed
--safe-links ignore symlinks that point outside the tree
-k, --copy-dirlinks transform symlink to dir into referent dir
-K, --keep-dirlinks treat symlinked dir on receiver as dir
-H, --hard-links preserve hard links
我如何知道在解析目标路径时应该遵循rsync
的mysymlink
链接?