Filenames

diff 顯示一個不存在的文件

  • July 12, 2019

我在外部硬碟上創建了備份。然後我創建了另一個備份並將所有文件複製到另一個外部硬碟。我想檢查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。

diff -rwith a German locale的輸出將 a 添加.到文件中。

文件backup1/home/user/file.xls應該backup1/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

引用自:https://unix.stackexchange.com/questions/529854