Created
January 11, 2015 20:28
-
-
Save igorcoding/a48780151ea48002911d to your computer and use it in GitHub Desktop.
Batch rename
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 | |
SRC=$1 | |
DEST=$2 | |
i=1 | |
for ph in ${SRC}/*; do | |
filename=$(basename "$ph") | |
ext="${filename##*.}" | |
new_filename="${i}.${ext}" | |
#echo $new_filename | |
((i++)) | |
cp $ph $DEST/$new_filename | |
echo "$ph -> $DEST/$new_filename" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Such script!
Very useful!
Wow!