Skip to main content
Participant
September 9, 2020
Question

Batch rename in Photoshop, NOT Bridge?

  • September 9, 2020
  • 2 replies
  • 9167 views

I'm trying to add a batch rename function to my Automate process in Photoshop.  I'm trying to name a bunch of files by it's folder name with a sequential number.  All I can see is that you can name a file by it's document name, but not it's folder name.  There is batch rename function in Bridge, but Bridge doesn't have Automate.

 

Is there a script so I can Automate/Rename everything by it's folder name using Photoshop?

This topic has been closed for replies.

2 replies

JJMack
Community Expert
Community Expert
September 9, 2020

You would most likely want the retain the file extension just change the file name.  Rename or move is a standard file system operation and I'm sure there are many renaming script available on the web and  also in many applications have file renaming features why reinvent the wheel when there are so many around.

Batch File Rename Script 

JJMack
Stephen Marsh
Community Expert
Community Expert
September 9, 2020

Adobe Bridge's Batch Rename option does have an option to use the Folder name.

 

 

Otherwise, a Bridge script could write the folder name to an unused metadata field (Creator, Headline or Title) and then the Batch Rename could use the metadata and sequence number.

GriffMAuthor
Participant
October 11, 2020

Thanks but this doesn't answer my question.  Is there a way to use Automate in Photoshop to do the same thing?  Or use Automate in Photoshop so it uses this rename function in Bridge?  I just want to hit Automate and it goes through all the files and renames everything by it's folder name, and not have to dive into every folder in bridge just to rename.

GriffMAuthor
Participant
October 12, 2020

Try this script + action + batch workflow:

 

 

/* 
Dupe active doc using parent directory name.jsx
https://community.adobe.com/t5/photoshop/batch-rename-in-photoshop-not-bridge/m-p/11500145
Intended for use with the Automate/Batch command to create sequentially serial-numbered files named after the parent folder
*/

dupeRename();

function dupeRename() {
    try {
        app.activeDocument.path; // File path must exist

        var origDoc = app.activeDocument;
        var dirName = app.activeDocument.path.fsName.replace(/.+\//, ''); // parent directory name
        origDoc.duplicate(dirName, false); // change to true to flatten
        origDoc.close(SaveOptions.DONOTSAVECHANGES);

    } catch (err) {
        // alert("An image must be saved before running this script!");
    }
}

 

 


https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html?m=1

 

Then record the script into the action that the Batch command will play:

 

 

Then set up Automate/Batch:

 

 

Then enjoy!


Thank you!  It's starting to work and dupes and renames the files by parent folder, BUT it doesn't save into a sequential digit serial number.  It just opens all the files and all of the files are all named the same.

 

Ideally I'd like to just select a folder and it updates all of the names with the sequential number and goes into another script I have and saves them into another folder. 

 

Right now, it goes through the script above and it stops with that script, and leaves all of the images open and named the same.  Help?