Quick bash command to mass rename files in numbered sequence

Just a quick bash command to rename all files in a directory in a numbered sequence.

d=0;
for i in *.jpg ;
do
    d=$((d+1));
    mv {"$i","$d.jpg"} ;
done

This is going to rename all jpg files in the directory to 1.jpg, 2.jpg, 3.jpg and so on.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.