little mass list rename script
quick and dirty script to rename *.jpg in one folder to poa_xxx.jpg numerically
yes there is a way to do this in a shorter and cleaner matter.
but i was tired and just wanted to get it done.
#/bin/bash
n=1
for f in *.jpg
do
if [ $n -le 9 ]; then
mv "$f" "poa_000$n.jpg"
else
if [ $n -ge 10 -a $n -le 99 ]; then
mv "$f" "poa_00$n.jpg"
else
if [ $n -ge 100 -a $n -le 999 ]; then
mv "$f" "poa_0$n.jpg"
else
mv "$f" "poa_$n.jpg"
fi
fi
fi
n=$(( $n + 1 ))
done
Leave a Reply