内部に異なるフォルダを持つ2つのフォルダがあります。このフォルダには他のファイルも含まれています。私はこれら2つの親フォルダ間の違いを提供できるコマンドを探しています。あるフォルダーに含まれるファイルと別のフォルダーに含まれていないファイルの間には違いがあるだけでなく、ファイルの内容にも違いがあります。
これまで私はこれをやってきました:diff -rq fold1 fold2
..しかし、それはこれらのファイル間の違いを提供しません。
どのコマンドを実行できますか?
ベストアンサー1
たぶんあなたは利用可能です同期これを行うための技術です。
rsync --dry-run --delete --recursive --verbose dir1/ dir2
または短いバージョン
rsync -nrv --delete dir1/ dir2
--dry-runまたは-nオプションを忘れないでください。それ以外の場合、ターゲットディレクトリ(dir2)はソースディレクトリ(dir1)と同じになります。
これにより、ディレクトリ名、ファイル名、ファイルの内容など、2 つのディレクトリ間の違いが出力されます。 (他の2台のコンピュータの2つのディレクトリを比較することもできます)
sending incremental file list
deleting dir3-1/ # this directory (name) doesn't exist in source directory
deleting file2.txt # this file (name) doesn't exist in source directory
file1.txt # this file is different (content) from the source files
dir3/ # this directory (name) doesn't exist in destination directory
sent 95 bytes received 21 bytes 232.00 bytes/sec
total size is 4 speedup is 0.03 (DRY RUN)