ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: mrtom on September 27, 2015, 05:49:41 AM

Title: Batch rename to filename + xmp:title (iptc title)
Post by: mrtom 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:

@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
Title: Re: Batch rename to filename + xmp:title (iptc title)
Post by: Alan Clifford 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).

QuoteMeans 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?
Title: Re: Batch rename to filename + xmp:title (iptc title)
Post by: ryerman on September 27, 2015, 10:22:47 AM
Quote from: mrtom on September 27, 2015, 05:49:41 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