Guest User

Untitled

a guest
Nov 21st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #!/bin/bash
  2. #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:
  3.  
  4. find /dir1/ -type f -exec md5sum {} + | sort -k 2 > dir1.txt
  5.  
  6. #Do the same procedure to the another directory:
  7.  
  8. find /dir2/ -type f -exec md5sum {} + | sort -k 2 > dir2.txt
  9.  
  10. #Then compare the result two files with diff:
  11.  
  12. diff -u dir1.txt dir2.txt
  13.  
  14. #Or as a single command using process substitution:
  15.  
  16. 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