1
我想比较两个目录。他们是这样的:BASH - 比较两个目录,-r --exclude不会这样做
Catalogue1 Catalogue 2
file1.txt file1.txt
file2.txt file2.txt
file3.txt file3.txt
file4.txt file4.txt
file5.txt file5.txt
file6.txt file6.txt
files.zip files.zip
我只是想有比较* .txt文件,但该命令
diff -r --exclude=".zip" $CURRENT_BUILD_DIR $PREVIOUS_BUILD_DIR >> $DIFF_DIR/DIFF.TXT
是没有用的在这里。这个命令的效果如下所示
Files /home/blah/workspace/Catalogue1/files.zip and /home/blah/workspace/Catalogue2/files.zip are different. // not sure about that, translated it from German.
diff -r '--exclude=.zip' /home/blah/workspace/Catalogue1/file1.TXT /home/blah/workspace/Catalogue2/file1.TXT
1c1
< 1
---
> 2
为什么diff仍然试图比较zip文件,即使使用exclude选项?
您还没有下令'diff'命令排除ZIP文件,但只有名字'.zip'文件。要排除任何ZIP文件,您必须使用'--exclude =“*。zip”'。 'exclude'选项允许一个文件名模式;不是文件扩展名模式。 – Jdamian 2014-12-02 12:25:33