I always have clients sending me images and other assets for their web projects. Sometimes they send them over in a nice format, other times not so much. I’ve been using the REN command in windows to do a lot of the automated work.
First you will want to CD (Change Directory) to the one that you want to work within. In windows 7 this is pretty easy, just hold down the SHIFT key and RIGHT click on the folder you want to work in. You will then see a “Open Command Window Here” option, or you can always just go to Run > cmd, then go to the specific directory.
The REN (Rename) command is pretty simple, it’s just:
REN oldname newname REN old_image.jpg new_image.jpg
You can also use * as a wildcard and ? for a space, as well as putting quotes around text.
This is probably the most common one that I use. All of our websites we create all reference the lower case extension, our Linux box views uppercase and lowercase as different files, so if an uppercase one gets uploaded, it won’t show. So the simple command is just:
REN *.JPG *.jpg
One client sent me some files like: 0134-009_s1 copy.jpg, 0134-009_s2 copy.jpg, 0134-009_s3 copy.jpg, 0134-009_s4 copy.jpg, 0134-009_L1 copy.jpg, 0134-009_L2 copy.jpg, 0134-009_L3 copy.jpg, 0134-009_L4 copy.jpg. I had to remove the ” copy” part of the file, and there were about 800 of these images with the same naming convention. Luckily they all had either 1-4 before the space and “copy” so I was able to use that to my benefit. 4 commends later, they were all renamed:
REN "*1?copy.jpg" *1.jpg REN "*2?copy.jpg" *3.jpg REN "*3?copy.jpg" *3.jpg REN "*4?copy.jpg" *4.jpg
This saves a bunch of time when you have a lot of files to rename. It sure beats manually renaming 800 files one by one. What other REN commands have you used?