Highlighted

Batch rename in Photoshop, NOT Bridge?

New Here ,
Sep 08, 2020

Copy link to clipboard

Copied

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?

TOPICS
Actions and scripting, How to

Views

151

Likes

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

Batch rename in Photoshop, NOT Bridge?

New Here ,
Sep 08, 2020

Copy link to clipboard

Copied

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?

TOPICS
Actions and scripting, How to

Views

152

Likes

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
Sep 08, 2020 0
Adobe Community Professional ,
Sep 09, 2020

Copy link to clipboard

Copied

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

 

rename.png

 

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.

Likes

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
Reply
Loading...
Sep 09, 2020 1
New Here ,
Oct 11, 2020

Copy link to clipboard

Copied

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.

Likes

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
Reply
Loading...
Oct 11, 2020 0
Adobe Community Professional ,
Oct 11, 2020

Copy link to clipboard

Copied

My previous reply focused on Bridge and avoided Photoshop as this is an out-of-the-box feature of Bridge. Photoshop does not offer this by default without custom scripting.


Bridge can show all files from all sub folders, which helps with selecting all required files for batch renaming in a single pass.

 

Otherwise a custom Photoshop script would be required. Easiest would be to dupe/rename/close original, which would be incorporated into an action that was then used by the automate/batch command.

 

The other option would be to script the batch saving and renaming etc in the custom script without using batch automate, which is much more work.

Likes

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
Reply
Loading...
Oct 11, 2020 0
Adobe Community Professional ,
Oct 11, 2020

Copy link to clipboard

Copied

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:

 

action.png

 

Then set up Automate/Batch:

 

batch.png

 

Then enjoy!

Likes

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
Reply
Loading...
Oct 11, 2020 0
New Here ,
Oct 12, 2020

Copy link to clipboard

Copied

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?

Likes

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
Reply
Loading...
Oct 12, 2020 0
New Here ,
Oct 12, 2020

Copy link to clipboard

Copied

I think I got it to work!  Thank you!  I'll keep testing.

Likes

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
Reply
Loading...
Oct 12, 2020 0
Adobe Community Professional ,
Oct 12, 2020

Copy link to clipboard

Copied

Yes, all the script does is dupes and closes the original file with the new duped name being based on the parent directory. It's just a helper script to do the one thing that you can't do with the out of the box tools.

 

You have to introduce the numbering in the batch rename as per my previous screenshot:

 

batch.png

 

Without adding sequential numbering, every file would have the same name (the name of the parent folder).

Likes

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
Reply
Loading...
Oct 12, 2020 0
Adobe Community Professional ,
Oct 12, 2020

Copy link to clipboard

Copied

Take a look at the action steps, you have to design the action to save and then close the "temp" file without saving etc:

 

action.png

Likes

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
Reply
Loading...
Oct 12, 2020 0
Most Valuable Participant ,
Sep 09, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Sep 09, 2020 1