0

Possible Duplicate:
How can I mass rename files from the command line or using a 3rd party tool?

The title says it all.

The problem is that the first nine files of a couple of hundred are named

1.jpg 2.jpg 3.jpg . . . and so on till..

9.jpg

This screws up the order of the files.

Fixing it manually for a couple of thousand folders could take a long time.

i'm willing to do these one folder at a time if not all at once.

Yet I confess to be ignorant of shell code and programming languages.

Instructions for a batch rename utility will be appreciated.

0

In a POSIX shell (e.g. bash) you can run

for i in *.jpg ; do
    mv $i `printf '%04d' ${i%.jpg}`.jpg
done

This renames all files X.jpg in the current directory to four digits with prefix zero's. Note that it assumes that all files *.jpg have numbers in their base part only.

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.