Porównaj dwa foldery z wieloma plikami wewnątrz zawartości

Mają dwa foldery z ok. 150 plików właściwości java.

W skrypcie powłoki, Jak porównać oba foldery, aby sprawdzić, czy w żadnym z nich nie ma nowego pliku właściwości i jakie są różnice między plikami właściwości.

Wyjście powinno być w formacie raportu.

Author: zx8754, 2009-10-29

5 answers

Aby uzyskać podsumowanie nowych / brakujących plików i które Pliki się różnią:

diff -arq folder1 folder2
 164
Author: reko_t,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2009-10-29 15:42:35

diff -r zrobi to, informując zarówno o tym, czy jakiekolwiek pliki zostały dodane lub usunięte, jak i o tym, co zmieniło się w plikach, które zostały zmodyfikowane.

 24
Author: John Kugelman,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2009-10-29 15:55:46

Użyłem

diff -rqyl folder1 folder2 --exclude=node_modules

W moich aplikacjach nodejs.

 1
Author: Melvin,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-08-14 15:22:49

Czy mógłbyś użyć dircmp ?

 0
Author: toolkit,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2009-10-29 15:38:29

Polecenie Diff w Uniksie służy do znajdowania różnic między plikami(wszystkie typy). Ponieważ katalog jest również typem pliku, różnice między dwoma katalogami można łatwo ustalić za pomocą poleceń diff. Aby uzyskać więcej opcji Użyj man diff na swoim unix boxie.

 -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)'.
I jest ich wiele więcej.
 -1
Author: Sachin Chourasiya,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2009-10-30 06:38:40