I have a bunch of pictures, some are .jpg
, some are .png
. any given picture could have an entirely random name (possibly including spaces). in any given directory, how can I rename all of them, while keeping the extension as is? the input, for example:
001.jpg 02.png 05.png zzzz.jpg
I would like to completely replace their names with four-digit numbers, starting with 0001
, and going up to 9999
(if necessary). thus, the output might look like:
0001.jpg 0002.png 0003.png 0004.jpg
the order of these files is important to me, but they are already in sequential order if I were to sort them by filename alone.
I have checked out the perl rename
, and its usage is a mystery to me in this example.