Batch Renaming Photoshop.psd Files From TextLayerText with Multiple Text Layers

Started by skern, April 13, 2020, 09:05:27 PM

Previous topic - Next topic

skern

I have several slides that all have 3 text layers (title, author, filename).  The problem is I am trying to batch rename these files using the "filename" text layer.  Here is the meta tag info:

Text Layer Name                 : Title, Author, filename
Text Layer Text                 : Welcome and Introductions, Christopher Ahmad MD, iem-testdata\script\09-20-19_Americana_Ball_0725_Ahmad.avs

I use this command line:

exiftool "-FileName<${XMP-photoshop:TextLayerText;tr/-_0-9a-zA-Z//dc}.%e" "Y:\iem-testdata\gfx\TitleSlides"

The result is a filename that is a concatenation of all 3 text layers instead of just the "filename"

filename result:  "Y:\iem-testdata\gfx\TitleSlides\WelcomeandIntroductionsChristopherAhmadMDiem-testdatascript09-21-19_Americana_Ball_0725_Ahmadavs.psd"

I think the solution may be in the regex but I'm not too good at manipulating string data.  Is there a way to just get the filename from the Text Layer Text tag?

Phil Harvey

Try this:

exiftool "-FileName<${XMP-photoshop:TextLayerText;s/.*,\s*//;tr/-_0-9a-zA-Z//dc}.%e" "Y:\iem-testdata\gfx\TitleSlides"

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

skern

Oh yeah!  That did it.  I thought I would post the command that works great on Windows CMD batch script.  I just hit the donate button as well.  This is an amazing tool.

exiftool "-FileName<${XMP-photoshop:TextLayerText;s/.*,\s*//;tr/-_0-9a-zA-Z//dc}" "%CD%" > title-log.txt 2>&1

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).