Author Topic: Batch rename to filename + xmp:title (iptc title)  (Read 2507 times)

mrtom

  • Newbie
  • *
  • Posts: 1
Batch rename to filename + xmp:title (iptc title)
« on: September 27, 2015, 05:49:41 AM »
Hi there,

great tool!!! I already solved a few of my picture problems... ;)
Sincew yesterday I'm trying now to create a batch file to rename files to
"filename title.jpg"
Means that the new filename should start with the original filename, then added the title (iptc / xmp:title) and then the extension.
I tried the following:
Code: [Select]
@echo off

:: Loop over all .jpg files in the current directory
for %%F in (*.jpg) do "C:\@portableApps\exiftool\exiftool.exe" "-filename<xmp:title" "%%F"

:: If an error occured, pause, so you can see the error...
if %errorlevel% neq 0 pause

but that only renames the file to the title (without the original filename and the extension).
Adding ".%e" gives an error.

Anybody with any idea here? Help would really be apppreciated.

Regards,
Tom

Alan Clifford

  • ExifTool Freak
  • *****
  • Posts: 543
    • A selection of Alan Clifford's photographs
Re: Batch rename to filename + xmp:title (iptc title)
« Reply #1 on: September 27, 2015, 09:19:53 AM »
If you type just exiftool at the command line, Phil has provided lots of examples.

exiftool '-filename<%f_${model;}.%e' dir
            Rename all files in "dir" by adding the camera model name to the
            file name.  The semicolon after the tag name inside the braces
            causes characters which are invalid in Windows file names to be
            deleted from the tag value (see the -p option documentation for an
            explanation).

Quote
Means that the new filename should start with the original filename, then added the title (iptc / xmp:title) and then the extension.

Something you are doing but have missed out of that spec. is "then add a space".  Do you want the space if you have no title?

ryerman

  • Sr. Member
  • ****
  • Posts: 132
Re: Batch rename to filename + xmp:title (iptc title)
« Reply #2 on: September 27, 2015, 10:22:47 AM »
....but that only renames the file to the title (without the original filename and the extension).
Adding ".%e" gives an error.

Anybody with any idea here?....
It can be a one line bat file:
exiftool -k -r -if $xmp:title "-filename<%%f ${xmp:title;}.%%e" -ext jpg %1

See http://www.exiftool.org/exiftool_pod.html#renaming_examples
Windows 10 Home 64 bit, Exiftool v11.86