比较内容中有多个文件的两个文件夹

有两个文件夹约。 150个java属性文件。

在shell脚本中,如何比较两个文件夹以查看是否有任何新的属性文件,以及属性文件之间的区别。

输出应该是报告格式。

要获取新文件/缺失文件的摘要,以及哪些文件不同:

diff -arq folder1 folder2 

diff -r会执行此操作,告诉你是否有文件被添加或删除,以及文件中被修改的内容。

我用了

 diff -rqyl folder1 folder2 --exclude=node_modules 

在我的nodejs应用程序。

你可以用dircmp吗?

Unix中的Diff命令用于查找文件(所有types)之间的差异。 由于目录也是一种文件,所以通过使用diff命令可以很容易地找出两个目录之间的差异。 要获得更多选项,请在您的unix框中使用man diff

  -b Ignores trailing blanks (spaces and tabs) and treats other strings of blanks as equivalent. -i Ignores the case of letters. For example, `A' will compare equal to `a'. -t Expands <TAB> characters in output lines. Normal or -c output adds character(s) to the front of each line that may adversely affect the indentation of the original source lines and make the output lines difficult to interpret. This option will preserve the original source's indentation. -w Ignores all blanks (<SPACE> and <TAB> char- acters) and treats all other strings of blanks as equivalent. For example, `if ( a == b )' will compare equal to `if(a==b)'. 

还有更多。