Solved

Script for renaming jpg

Posted on 2014-11-06
3
330 Views
Last Modified: 2014-11-06
I need to rename about 300 student pix.  Currently, they are labeled 001.jpg, 002.jpg and so on.  I need to rename them to their individual student ID with the jpg extension.

I have an excel spreadsheet that has Column B with the 001.jpg format and Column C with the matching studentID.jpg format.

Is there a way to have the actual pictures renamed automatically without having to manually copy the student ID, go to the jpg picture and do a rename? 300 manual cut and pastes are not on my list of IT "to do's" but I seem to be the one who is left dealing with it.

By the way, I need this format to get the pictures into our SIS and another program.

Any help is appreciated.
0
Comment
Question by:smantz
3 Comments
 
LVL 24

Assisted Solution

by:Phillip Burton
Phillip Burton earned 50 total points
ID: 40426258
Either:

1.Create a BAT file (which is a text file which has the extension .bat instead of .txt) in that folder - or
2. open up a command window and go to that folder (easiest way - open Windows Explorer, Shift-click on a folder, and select "Open command window here").

Then copy text from the spreadsheet. What text? Text in the format:

ren "OldName.jpg" "NewName.jpg"

If you have the information in cell B2 and C2, then D2 would be:

="ren """ & B2 & """ """ & C2 & """"

Open in new window


and copy that downwards.

Verify that that looks good (and make a copy of the Windows Explorer folder before doing this - you cannot undo it).

Then either:

1. copy it into the BAT file, close the BAT file, and double-click on it, or
2. go into your Command Window, right-hand click, and paste.

In case you typed the list that you have in column B previously, then you can always use a cataloger such as the one in www.filecats.co.uk to generate that list (just in case you have additional photographs in other folders to rename - that might save you a little time later).
0
 
LVL 23

Accepted Solution

by:
Eirman earned 450 total points
ID: 40426285
> Export your excel file as a CSV file.
> Open Flash renamer and follow the instructions for renaming by using the instructions in a CSV file.
Extract From Help (Note: The rules are truncated in the above image)
Flash Renamer is a great little program and is well worth having.
0
 

Author Closing Comment

by:smantz
ID: 40426698
Wonderful program!  Thanks for the tip
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question