Mass Renaming Image Files in a folder based on excel sheet

Posted on 2006-05-06
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

    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
    COPY (CNTRL + C)

    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

    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

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

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Suggested Solutions

    One of the biggest challenges facing freelancers is balancing multiple projects and deadlines. Organizational skills and time management are key to keeping up with projects and staying on track. Luckily, we’ve curated seven tools to help you focus o…
    This story has been written with permission from the scammed victim, a valued client of mine – identity protected by request.
    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.
    Articles on a wide range of technology and professional topics are available on Experts Exchange. These resources are written by members, for members, and can be written about any topic you feel passionate about. Learn how to best write an article t…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now