Skip to content

Instantly share code, notes, and snippets.

@dettmering
Created February 14, 2014 13:49
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 dettmering/9001277 to your computer and use it in GitHub Desktop.
Save dettmering/9001277 to your computer and use it in GitHub Desktop.
Bash: Renames groups of images (329L_**_000x.tif) with a combined md5 hash of the group (329L_**-bac8dacd79_000x.tif)
#!/bin/bash
# Rename image files with md5 hash
mkdir out
for f in *.tif
do
splt=(${f//_/ })
c=$(cat ${splt[0]}\_${splt[1]}\_* | md5) # 329L_23_*
o=${splt[0]}\_${splt[1]}\-${c:0:10}\_${splt[2]}
echo $o
cp $f out/$o
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment