Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Use find to list all the files in the directory then calculate the md5 hash for each file and pipe it sorted by filename to a file:
- find /dir1/ -type f -exec md5sum {} + | sort -k 2 > dir1.txt
- #Do the same procedure to the another directory:
- find /dir2/ -type f -exec md5sum {} + | sort -k 2 > dir2.txt
- #Then compare the result two files with diff:
- diff -u dir1.txt dir2.txt
- #Or as a single command using process substitution:
- diff <(find /dir1/ -type f -exec md5sum {} + | sort -k 2) <(find /dir2/ -type f -exec md5sum {} + | sort -k 2
Add Comment
Please, Sign In to add comment