如何从rsync中排除.cpan文件夹?

时间:2013-08-08 11:06:26

标签: backup rsync cpan permission-denied

我使用 rsync 来备份我的Ubuntu安装的主目录(ext4)。我使用以下命令将文件和文件夹复制到远程服务器(ext4)。

$ rsync -rt --delete --delete-excluded --links \
  --exclude-from '/home/jjd/rsync-home-exclude.txt' \
  /home/jjd/ server:/volume1/backup-home

我定义了一些可以为备份忽略的文件夹和文件:

$ cat /home/jjd/rsync-home-exclude.txt
/home/jjd/.thumbnails/
/home/jjd/Downloads/.org.chromium.Chromium*
/home/jjd/.cpan
.cache/
*.swp
*.lock
*.tmp
/home/jjd/.local/share/recently-used.*
.TrueCrypt/.show-request-queue
.dropbox/command_socket
.dropbox/iface_socket
*.sock%

尽管如此, rsync 仍会报告以下错误:

rsync: opendir "/home/jjd/.cpan/build/local-lib-1.008009-Xl6GGK/inc" failed: Permission denied (13)
rsync: opendir "/home/jjd/.cpan/build/local-lib-1.008009-Xl6GGK/lib" failed: Permission denied (13)
rsync: opendir "/home/jjd/.cpan/build/local-lib-1.008009-Xl6GGK/t" failed: Permission denied (13)
IO error encountered -- skipping file deletion
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1070) [sender=3.0.9]

1 个答案:

答案 0 :(得分:1)

只需从排除文件中删除/home/jjd即可。根据rsync文档,前导斜杠不适用于文件系统的根,而是适用于“传输的根”。