2009-10-29 189 views

回答

152

要獲得新的/丟失的文件摘要,以及哪些文件有所不同:

diff -arq folder1 folder2 
+5

只有當文件不同時,'a'將所有文件視爲文本,'r'遞歸搜索子目錄,'q''簡要'報告 – MackM 2017-04-19 15:41:29

+0

@reko_t是否有任何方式通過'Java' – 2017-08-31 05:11:49

23

diff -r將執行此操作,告訴您是否添加或刪除了任何文件,以及已修改的文件中發生了哪些更改。

-1

在Unix中的diff命令是用來查找(所有類型)的文件之間的差異。由於目錄也是一種文件,因此可以通過使用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)'. 

還有更多。

1

我在應用程序的NodeJS使用

diff -rqyl folder1 folder2 --exclude=node_modules