Skip to content

Instantly share code, notes, and snippets.

@igorcoding
Created January 11, 2015 20:28
Show Gist options
  • Save igorcoding/a48780151ea48002911d to your computer and use it in GitHub Desktop.
Save igorcoding/a48780151ea48002911d to your computer and use it in GitHub Desktop.
Batch rename
#! /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
@alekseyl1992
Copy link

Such script!
Very useful!
Wow!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment