Advertisement
adilima

Convenient way creating MD5 for backup

Dec 19th, 2014
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.77 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. REPORT_PATH=$HOME/Desktop/LIFEBUOY/REPORTS
  4. BACKUP_PATH="/Volumes/BRO FILMS-LIBUOY SHAMPOO/LIFEBUOY/19-DESEMBER-2014/RAW"
  5. CARD_NAME=$2
  6. MEDIA_NAME=$1
  7.  
  8. echo "REPORT_PATH = $REPORT_PATH"
  9. echo "BACKUP_PATH = $BACKUP_PATH"
  10.  
  11. mkdir -pv "$REPORT_PATH/$CARD_NAME"
  12.  
  13. echo "Creating Media MD5 Checksums..."
  14. find "/Volumes/$MEDIA_NAME" -type f -name "*.R3D" -exec md5 '{}' > "$REPORT_PATH/$CARD_NAME/media-md5.txt" \;
  15.  
  16. echo "Creating Backup MD5 Checksums..."
  17. find "$BACKUP_PATH/$CARD_NAME" -type f -name "*.R3D" -exec md5 '{}' > "$REPORT_PATH/$CARD_NAME/backup-md5.txt" \;
  18.  
  19. MEDIA_MD5=$(cat "$REPORT_PATH/$CARD_NAME/media-md5.txt" | cut -d'=' -f2 | sed s/\ //)
  20.  
  21. echo $MEDIA_MD5
  22.  
  23. for token in $MEDIA_MD5; do
  24.   grep $token "$REPORT_PATH/$CARD_NAME/backup-md5.txt"
  25. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement