If you come across situation where you need to compare two directories in two different servers. md5sum command can be used, which will generate md5sum of files in directories and write it to one file. In turn that file can be used to check md5sum at destination.
Run below command at source location:
find /opt/ -type f -print0 | xargs -0 md5sum > /root/checksums_backup.md5
Once you run above command, it will create /root/checksums_backup.md5 file. You can copy this file to destination server and run below command to check md5sum.
Note: Source and Destination server should have the same directory structure.
md5sum -c /root/checksums_backup.md5
After running above command, you will see "OK" and "FAILED" output. According to that you can easily make out which files are different from source location.
Run below command at source location:
find /opt/ -type f -print0 | xargs -0 md5sum > /root/checksums_backup.md5
Once you run above command, it will create /root/checksums_backup.md5 file. You can copy this file to destination server and run below command to check md5sum.
Note: Source and Destination server should have the same directory structure.
md5sum -c /root/checksums_backup.md5
After running above command, you will see "OK" and "FAILED" output. According to that you can easily make out which files are different from source location.
No comments:
Post a Comment