Last Updated: September 09, 2019
·
202
· vicow

Rename all files in a directory with sequential numbers

Rename all files in a directory with sequential numbers

find . -name '*.jpg' | # find jpegs
awk 'BEGIN{ a=1 }{ printf "mv \"%s\" %02d.jpg\n", $0, a++ }' | # build mv command
bash # run that command

Source: http://stackoverflow.com/a/10780250/2086547