Compare two folders which has many files inside contents

后端 未结 5 1339
时光说笑
时光说笑 2020-12-07 09:58

Have two folders with approx. 150 java property files.

In a shell script, how to compare both folders to see if there is any new property file in either of them and

5条回答
  •  旧巷少年郎
    2020-12-07 10:02

    Diff command in Unix is used to find the differences between files(all types). Since directory is also a type of file, the differences between two directories can easily be figure out by using diff commands. For more option use man diff on your unix box.

     -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  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 ( and   char-
                     acters)  and  treats  all  other  strings of
                     blanks   as   equivalent.    For    example,
                     `if ( a == b )'   will   compare   equal  to
                     `if(a==b)'.
    

    and there are many more.

提交回复
热议问题