Skip to content

Instantly share code, notes, and snippets.

@czers
Created July 6, 2018 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save czers/43ee62b32ebd9d381ddfe59be637447e to your computer and use it in GitHub Desktop.
Save czers/43ee62b32ebd9d381ddfe59be637447e to your computer and use it in GitHub Desktop.
Assert safe removal of files - e.g. make sure that photos from SD card are all copied to your hard disk before deleting them
#!/bin/bash
function get-checksums-with-names {
find $1 -type f -exec basename "{}" \; > $2.names
#find $1 -type f -exec md5sum "{}" \; > $2.fullpaths.md5sum
#cut -c-32 $2.fullpaths.md5sum > $2.just.md5sum
#paste -d '|' $2.just.md5sum $2.names > $2.names.md5sum
}
get-checksums-with-names $1 $2
# compare with (example): sort Lumix.names 20172018.names 20172018.names | uniq -u | less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment