Created
August 26, 2012 15:53
-
-
Save andersonvom/3481270 to your computer and use it in GitHub Desktop.
Shift camera picture filenames by a certain amount to avoid files with same name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
INITIAL_NUM=1012 | |
SEPARATOR='_' | |
for i in *.JPG | |
do | |
basename=`basename $i .JPG` | |
prefix=`echo $basename | cut -d $SEPARATOR -f1` | |
current_num=`echo $basename | cut -d $SEPARATOR -f2` | |
new_num=`expr $INITIAL_NUM + $current_num` | |
mv $i ${prefix}${SEPARATOR}${new_num}.JPG | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment