Last active
November 27, 2019 04:10
-
-
Save JeonghunLee/a81f9ab3531bb3149dfb699e47335901 to your computer and use it in GitHub Desktop.
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 | |
# | |
# rename jpg files in sequence with same pattern | |
# | |
# Author : Jeonghun Lee | |
# Version : 0.1 | |
# | |
# ./rename.sh | |
# or | |
# ./rename.sh 1stArg 2ndArg | |
CNT=0 | |
PREFIX=${1:-"image_"} | |
POSTFIX=${2:-".jpg"} | |
echo -e "\e[91mStart: rename all jpg files to ${PREFIX}x${POSTFIX}\e[39m\n" | |
for FILE in *$POSTFIX | |
do | |
NAME=${PREFIX}${CNT}${POSTFIX} | |
echo -e "ORG:$FILE \e[34m NEW:$NAME \e[39m Index:$CNT" | |
mv $FILE $NAME | |
CNT=$((CNT+1)) | |
done | |
echo -e "\e[91mfinished \e[39m\n" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment