文件的递归差异不区分大小写

文件的递归差异不区分大小写

当文件名相同但大小写不同时,如何运行递归差异?

例如:

./Root/Directory/FileName.txt
./Branch/directory/filename.txt

diff -r -i Root Branch仅对文件内容不区分大小写,而不是名称。

答案1

该选项--ignore-file-name-case就是您所需要的:

diff -r --ignore-file-name-case Root Branch 

例如

mkdir dir1 dir2
touch dir1/fred dir2/Fred

diff -r dir1 dir2
Only in dir1: fred
Only in dir2: Fred

diff -r --ignore-file-name-case dir1 dir2  # no output - files match

相关内容