Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Mass Renaming Image Files in a folder based on excel sheet

Posted on 2006-05-06
Medium Priority
Last Modified: 2009-09-29
am using The Rename which allows all kind of forms etc to rename files..

i need now a new way to rename files in this way and was wondering if there is a solution for this:

        A                               B

1     DSC0001.jpg            table.jpg
2.    DSC0002.jpg            car77_647.jpg
3.    DSC0003.jpg            house4Sale_2004.jpg

basically i will need the tool to be able to lookup the file in Column B and rename the file in Column A
example: DSC001.jpg will be renamed to table.jpg

any advice is appreciated.
Question by:swisscommerce
LVL 14

Expert Comment

ID: 16622988
there is probably a better way to do this.  But this is quick and dirty
in cell C1 type                     ="Ren " & A1 & " " &B1
copy that formula down column C for the total number of entries you have

select the cells in column C that has valid entries; per the example above just select C1:C3

go to another sheet then select Cell A1 then

EDIT > PASTE SPECIAL >  choose Radio Button VALUES > Click on OK

This will create the command lines.

Save as a text file to the folder that you have the picture files in.  Choose File > Save As >  in the FileName textbox, type somthing like Change.bat
ensure that the file type is *.txt

Also you will need to ensure that the extension on the file you just created is .BAT when it is created.  

Then you can just doubleclick on the change.bat file you created, that'll change everything found in column A to column B


LVL 14

Accepted Solution

nltech earned 2000 total points
ID: 16623011
just a one time, or infrequent, thing?  i'd just whip up a batch file....

just take your spreadsheet

original1.jpg          newname1.jpg
original2.jpg          newname2.jpg
original3.jpg          newname3.jpg

and insert a new column at the left, and add "ren" each line:

ren     original1.jpg     newname1.jpg
ren     original2.jpg     newname2.jpg
ren     original3.jpg     newname3.jpg

copy the table and paste it into notepad, make sure there's no stray lines or characters in it, save it to the folder the files are in as a .bat file, and then run it.

make sure there's visible quotes around any filenames (in the excel spreadsheet) that have spaces in them (needed to handle those types of filenames on the command line)... such as:

"new name 4.jpg"

your first run or two, you might want to backup the files to a different folder before running the batch, just in case.

Author Comment

ID: 16623278
thank you all. you both are great!  just nltech was little bit more straight forward. thanks.

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

This article is written by John Gates, CISSP. Gates, the SNUG President-Elect, currently holds the position of Manager of Information Systems at Lake Park High School in Roselle, Illinois.
The deadly train derailment that occurred recently in DuPont, Washington, raises a lot of questions. It was a new route, the first trip tested with passengers, and the train was travelling at 50 mph over the zone’s speed limit. Could IoT play a role…
Notifications on Experts Exchange help you keep track of your activity and updates in one place. Watch this video to learn how to use them on the site to quickly access the content that matters to you.
Where to go on the main page to find the job listings. How to apply to a job that you are interested in from the list that is featured on our Careers page.
Suggested Courses

572 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