Created
June 18, 2014 15:03
-
-
Save speed-of-light/078adb852c32f678446f to your computer and use it in GitHub Desktop.
decrease Increase file by 1 or other variable
This file contains hidden or 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 | |
| dir=$1 | |
| for f in "$dir"/*; do | |
| pre=${f:0:4} | |
| post=${f:7} | |
| fn=$((${f:4:3} - 1)) | |
| jj=`printf "%03d" $fn` | |
| mv $f $pre${jj}_tmp$post # prevent overrite | |
| done | |
| rename -v 's/(\w{3}\/\d{3})[_tmp]+.jpg$/$1.jpg/' $dir/*.jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment