diff 显示不存在的文件

diff 显示不存在的文件

我在外部硬盘上创建了备份。然后我创建了另一个备份并将所有文件复制到另一个外部硬盘。我想检查diff是否所有内容都被复制:

user@user:/media/user$ diff -r backup backup1
Nur in backup1/home/user: file.xls.
Nur in backup1/home/user: file.zip.

(“nur”是德语,意思是“唯一”。)

差异显示两个不存在的文件:

user@user:/media/user$ file backup1/home/user/file.xls.
backup1/home/user/file.xls.: cannot open backup1/home/user/file.xls. (No such file or directory)
user@user:/media/user$ file backup1/home/user/file.zip.
backup1/home/user/file.zip.: cannot open backup1/home/user/file.zip. (No such file or directory)

diff 是如何显示这两个文件的?如何修复 diff 的输出?两个外部硬盘上的文件系统都是 LUKS。

答案1

diff -rwith a German locale的输出会将 a 添加.到文件中。
文件backup1/home/user/file.xlsbackup1/home/user/file.zip应该存在。

例子:

$ mkdir dir1 dir2
$ touch dir1/foo
$ LANG=de_DE.UTF8 diff -r dir1 dir2
Nur in dir1: foo.
$ diff -r dir1 dir2
Only in dir1: foo

相关内容