我使用 rsync 备份我的文件。同步后,我运行它并期望什么也看不到,但它看起来像是在跳过目录。我(显然)改变了名字,但我相信我仍然能捕捉到所有我能捕捉到的信息。这里发生了什么?
$ ls -l /source/backup/myfiles
drwxr-xr-x 2 me me 4096 2010-10-03 14:00 foo
drwxr-xr-x 2 me me 4096 2011-08-03 23:49 bar
drwxr-xr-x 2 me me 4096 2011-08-18 18:58 baz
$ ls -l /destination/backup/myfiles
drwxr-xr-x 2 me me 4096 2010-10-03 14:00 foo
drwxr-xr-x 2 me me 4096 2011-08-03 23:49 bar
drwxr-xr-x 2 me me 4096 2011-08-18 18:58 baz
$ file /source/backup/myfiles/foo
/source/backup/myfiles/foo/: directory
然后我同步(预计没有变化):
$ rsync -rtvp /source/backup /destination
sending incremental file list
backup/myfiles
skipping non-regular file "backup/myfiles/foo"
skipping non-regular file "backup/myfiles/bar"
这是奇怪的部分:
$ echo 'hi' > /source/backup/myfiles/foo/test
$ rsync -rtvp /source/backup /destination
sending incremental file list
backup/myfiles
backup/myfiles/foo
backup/myfiles/foo/test
skipping non-regular file "backup/myfiles/foo"
skipping non-regular file "backup/myfiles/bar"
它成功了:
$ ls -l /source/backup/myfiles/foo
-rw-r--r-- 1 me me 3126091 2010-06-15 22:22 IMGP1856.JPG
-rw-r--r-- 1 me me 3473038 2010-06-15 22:30 P1010615.JPG
-rw-r--r-- 1 me me 3 2011-08-24 13:53 test
$ ls -l /destination/backup/myfiles/foo
-rw-r--r-- 1 me me 3126091 2010-06-15 22:22 IMGP1856.JPG
-rw-r--r-- 1 me me 3473038 2010-06-15 22:30 P1010615.JPG
-rw-r--r-- 1 me me 3 2011-08-24 13:53 test
但还是:
$ rsync -rtvp /source/backup /destination
sending incremental file list
backup/myfiles
skipping non-regular file "backup/myfiles/foo"
skipping non-regular file "backup/myfiles/bar"
其他说明:
我的实际目录“foo”和“bar”确实有空格,但没有其他奇怪的字符。其他目录有空格,没有问题。我 'stat'-ed 并没有看到不同步的目录和那些不同步的目录之间没有区别。
如果您需要更多信息,请尽管询问。
最佳答案
您确定那些单独的文件不是符号链接(symbolic link)吗?
Rsync 有一些有用的标志,例如 -l
,它将“将符号链接(symbolic link)复制为符号链接(symbolic link)”。将 -l
添加到您的命令中:
rsync -rtvpl /source/backup /destination
我相信默认情况下会跳过符号链接(symbolic link),因为它们可能存在安全风险。查看手册页或 --help 了解更多信息:
rsync --help | grep link
要验证这些是符号链接(symbolic link)或主动查找符号链接(symbolic link),您可以使用 file 或 find:
$ file /path/to/file
/path/to/file: symbolic link to `/path/file`
$ find /path -type l
/path/to/file
关于linux - rsync 为看似常规的目录打印 "skipping non-regular file",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7180420/