Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Shortly, I'll be required to rename 22,000 .jpg files from imagereference.jpg to itemcode.jpg.

The rename itself isn't a problem, the issue lies with several thousand of the images are currently referenced numerous times, meaning I'll need to create a single image for each item code, for example...Item codes 755117, 755118, 755119 & 755120 all currently use a single .jpg (image reference cly123.jpg) as their image, whereas they all now need to have a .jpg each named with their individual item code.

While it's easy enough to manually dupliate cly123.jpg four times and rename them 755117.jpg, 755118.jpg, 755119.jpg and 755120.jpg, I have over 7,000 items codes referencing 2,700 images, and in a couple of cases, over 50 item codes all currently use the same image, so I'll need to duplicate the image another 49 times before I can rename them to the new itemcode.jpg

I have a list of all the item codes, and which image they currently reference - is there an easy way to automatically duplicate the images the required amount of times each as per the list, or am I going to have to bite the bullet and do them manually?

share|improve this question
Do the names have to coincide with the image references? – Dave Dec 13 '12 at 15:23
Where are the file names being referenced multiple times - in a database? – Dave Dec 13 '12 at 15:24

Programming this is your best bet, taking in a list with the references -> itemcode mapping. Could be done in pretty much any language.

But since you're asking your question on SuperUser, and not on StackOverflow, I assume this is not an option. In that case, a renaming tool like FilerFrog can speed things up, although that is definitely not going to cover everything.

share|improve this answer
Cheers, I'll give FilerFrog a look. – Chris McPhie Dec 13 '12 at 14:45

You can avoid duplicating the images by using hardlinks to make it appear like all the needed jpg files exist independently when it's actually just one file. You can make these in Windows 7 with the mklink command-line utility. On Windows XP you can use the free junction utility to create them. Either of these utilities could be used in a batch file to make large numbers of them programmatically.

There's a also a nice utility named the Link Shell Extension which integrates with Explorer, but that wouldn't be much help making lots of them automatically.

share|improve this answer
Thanks, sadly we do require multiple images, as they'll be getting uploaded to numerous different places/burnt to CD etc.. – Chris McPhie Dec 13 '12 at 14:49
I don't think you understand. A hardlink is a way to give the same file many different file name without duplicating the actual contents of the file. – martineau Dec 13 '12 at 15:46

Bangs head on desk

Sorry, I've just realised, all I needed was a simple batch file to copy/rename the images based on the list I already had.

Y'know when something's so obvious, you just can't see it....yeah, that....

Thanks for the replies, much appreciated.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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