Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.