• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

rename series of files using excel list?

New Here ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

HI!
I have a series of file.jpg,

I have to rename using a series of names present in an excel column, is it possible? 

TOPICS
Feature request , How to

Views

2.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Sep 16, 2022 Sep 16, 2022

Ok, this is a VERY basic routine to read in a tab-delimited list of files with old name <tab> new name format and rename files in the current folder.

You would need to run it from ESTK or VS Code, or write a wrapper to load it in Bridge and run it via menu. There is no error checking (for illegal filenames and such) and it will happily cause problems with duplicate filenames.

Feel free to use it in your own script. I don't have time at the moment to neaten it up.

    try{
        var renFile = n
...

Votes

Translate

Translate
LEGEND ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

You would need to write a script to do so.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

I have been working on script that does this. I still need to test it throughly before sharing. 

 

Here is the workflow:

- Select the files you want to rename
- Open the script and click the "Create List" button. This will generate a CSV list of the current file names
- Open the list of files in a spreadsheet
-- Enter new names in 'New File Name' column
-- Save as CSV file
- Open the script, select the CSV file as the source and click the "Rename Files" button

 

Does this sound like it would work for you?

There are risks in using a CSV, like misaligning the current and new filenames in the spreadsheet. Just saying, this will require extra care.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

I have some unpublished work scripts that do parts of this, plus my Folder List Export script saves a list of file names. Shouldn't be hard to cobble it together.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 14, 2022 Sep 14, 2022

Copy link to clipboard

Copied

I think it's perfect! (in some I might already have the list of "old" "new" names so the job would be half done ...)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2022 Sep 15, 2022

Copy link to clipboard

Copied

Both Mac and Windows OS have a native command line feature for this... Presuming that the originals and the new names "line up" and sort correctly,  it is easy enough to set this up in a spreadsheet, whether for 3 or 3000 files. Original names on the left, new names on the right. The command would be copied and pasted into Terminal.app or CMD.exe.

 

Mac (Terminal.app):

 

mv 'doc-1.ai' 'File One.ai'
mv 'doc-2.jpg' 'File Two.jpg'
mv 'doc-3.tif' 'File Three.tif'

 

Win (CMD.exe):

 

ren "doc-1.ai" "File One.ai"
ren "doc-2.jpg" "File Two.jpg"
ren "doc-3.tif" "File Three.tif"

 

Notice how similar the two methods are. You need to run the command from the directory containing the files, not from the default location. Ensure that Mac single straight quotes and Win double straight quotes don't get reformatted.

 

Also discussed here:

https://community.adobe.com/t5/bridge-discussions/rename-multiple-files/td-p/12786213

 

Some Mac only methods here:

https://discussions.apple.com/thread/5849384

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 15, 2022 Sep 15, 2022

Copy link to clipboard

Copied

If you are already using Excel, you can write some simple VBA code to rename files. And there are bespoke bulk renaming utilities out there as well.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 16, 2022 Sep 16, 2022

Copy link to clipboard

Copied

Ok, this is a VERY basic routine to read in a tab-delimited list of files with old name <tab> new name format and rename files in the current folder.

You would need to run it from ESTK or VS Code, or write a wrapper to load it in Bridge and run it via menu. There is no error checking (for illegal filenames and such) and it will happily cause problems with duplicate filenames.

Feel free to use it in your own script. I don't have time at the moment to neaten it up.

    try{
        var renFile = new File('~/Desktop').openDlg('Select Naming Pairs File', '*.txt'); //select naming pairs file
        if(renFile != null){ //open and read in terms file
            renFile.open('r');
            var i = 0;
            var renList = [];
            var renLine = renFile.readln();
            while(renLine != ''){ //read in search terms one line at a time, place in array
                renList[i] = renLine;
                renLine = renFile.readln();
                i = i + 1;
                }
            renFile.close();
            }
        var renParam = [];
        var renFolder = app.document.presentationPath; //current folder
        for(var j = 0; j < renList.length; j++){
            renParam = renList[j].split('\t'); //split old and new names
            if(renParam[0] != '' && renParam[1] != ''){ //both specified
                var renTarget = new Thumbnail(renFolder + '\\' + renParam[0]); //find file
                renTarget.name = (renParam[1]); //rename
                }
            }
        }
    catch(e){ //oops
        alert(e + ' ' + e.line);
        }

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 16, 2022 Sep 16, 2022

Copy link to clipboard

Copied

Also note that the backslashes are Windows-specific, good practice is to use forward slashes in ExtendScript. You'd want to fix that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 17, 2022 Sep 17, 2022

Copy link to clipboard

Copied

@Lumigraphics 

 

Thank you for sharing!

 

I'll add the menu option, I don't do much Bridge scripting but this should be within my capabilities.

 

In the meantime, one can drag the .jsx file onto the Bridge icon or select the .jsx file and right-click and select "open with" and point it to the Bridge app.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 17, 2022 Sep 17, 2022

Copy link to clipboard

Copied

I have added the code from @Lumigraphics into a menu-item "Rename from Text File" under the Tools menu. Tested on Bridge 2022 on a Mac.

 

/*
https://community.adobe.com/t5/bridge-discussions/rename-series-of-files-using-excel-list/td-p/13196186

by Lumigraphics

Ok, this is a VERY basic routine to read in a tab-delimited list of files with old name <tab> new name format and rename files in the current folder.
You would need to run it from ESTK or VS Code, or write a wrapper to load it in Bridge and run it via menu. There is no error checking (for illegal filenames and such) and it will happily cause problems with duplicate filenames.
Feel free to use it in your own script. I don't have time at the moment to neaten it up.

////////// TAB DELIMITED TXT FILE EXAMPLE //////////

oldname1.jpg	new_name-1.jpg
oldname2.jpg	new_name-2.jpg
oldname3.jpg	new_name-3.jpg

////////////////////////////////////////////////////

*/

#target bridge;

if( BridgeTalk.appName == "bridge" ) { 
reNamer = new MenuElement("command", "Rename from Text File", "at the end of tools");
}

reNamer.onSelect = function () { 
    try {
        //select naming pairs file
        var renFile = new File('~/Desktop').openDlg('Select Naming Pairs File', '*.txt');
        //open and read in terms file
        if (renFile != null) {
            renFile.open('r');
            var i = 0;
            var renList = [];
            var renLine = renFile.readln();
            //read in search terms one line at a time, place in array
            while (renLine != '') {
                renList[i] = renLine;
                renLine = renFile.readln();
                i = i + 1;
            }
            renFile.close();
        }
        var renParam = [];
        //current folder
        var renFolder = app.document.presentationPath;
        for (var j = 0; j < renList.length; j++) {
            //split old and new names
            renParam = renList[j].split('\t');
            //both specified
            if (renParam[0] != '' && renParam[1] != '') {
                //find file
                var renTarget = new Thumbnail(renFolder + '/' + renParam[0]);
                //rename
                renTarget.name = (renParam[1]);
            }
        }
    //oops
    } catch (e) {
        alert(e + ' ' + e.line);
    }
}

 

  1. Open Adobe Bridge, then open Bridge’s preferences dialog
  2. Under Startup Scripts, click the "Reveal My Startup Scripts" button
  3. Copy/Paste or drag-n-drop your .jsx script files into the Startup Scripts folder/directory
  4. Quit and restart Bridge and answer "Yes" to enable the script.
 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 04, 2024 Dec 04, 2024

Copy link to clipboard

Copied

LATEST

This script is brilliant!  Worked like a charm once I properly formatted the 2 columns in Excel and then exported as tab-delimited text.

Also, lacking file extensions in my Excel rename column, I just used Bridge's built-in Batch Rename capability to add them:

_Aaron__1-1733339903933.png

 

Thank you @Stephen_A_Marsh and @Lumigraphics !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines