Quantcast
Channel: Lecciones Prácticas
Viewing all articles
Browse latest Browse all 33

Rename multiple files using sequence number in OSX from command line [SOLVED]

$
0
0

With this command you will rename all the jpg files in the current directory to PREFIX_0000.jpg to PREFIX_9999.jpg

find . -name '*.jpg' \
| awk 'BEGIN{ a=0 }{ printf "mv %s PREFIX_%04d.jpg\n", $0, a++ }' \
| bash

If you just need two numbers (PREFIX_00.jpg to PREFIX_99.jpg) you can do it by:

find . -name '*.jpg' \
| awk 'BEGIN{ a=0 }{ printf "mv %s PREFIX_%02d.jpg\n", $0, a++ }' \
| bash

The post Rename multiple files using sequence number in OSX from command line [SOLVED] appeared first on Lecciones Prácticas.


Viewing all articles
Browse latest Browse all 33

Trending Articles