Several -d in one commandline

Started by klemmleuchte, May 28, 2010, 11:14:08 AM

Previous topic - Next topic

klemmleuchte

Hi Phil,
next lap:
I know that -d is only with one single command to use.
To Copy Date/Time as CreatedDate/CreatedTime would be the need to repeat the formatting.
So I have to repeat in batch? ...or is there a way with -execute?

Phil Harvey

If you can do what you want in 2 commands, then it can be done in a single command with the -execute option.  But if you show me the exact command you want to use then maybe I can suggest something better.

- 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 ($).

klemmleuchte

Hello Phil,

first you have to know:
1. I do my pixelwork on the photo.
2. I save with a script which tags ImageDescription with my input.
3. I do the following batch on this photo, to reduce the input for the inidividual IPTC-tags.
4. I do the rest handmade individual inputs to IPTC-tags of this picture with an IPTC-tool.

The batch is mounted in a tools-button of the DOpus-filemanager. {filepath$} is the selected file to work on.
Quote@nodeselect
@nofilenamequoting
exiftool -F -Artist="Name" -IPTC:CopyrightNotice="Name" -IPTC:Writer-Editor="Name" -Copyright"<© $CreateDate Name" -d "%%Y" -IPTC:Country-PrimaryLocationName="Deutschland" -IPTC:Country-PrimaryLocationCode="DEU" {filepath$}
exiftool -IPTC:Keywords+"< $CreateDate" -d "%%Y" -IPTC:Caption-Abstract"< $ImageDescription" -IPTC:ObjectName"< $ImageDescription" {filepath$}
exiftool -IPTC:DateCreated<CreateDate -d "%%Y%%m%%d" {filepath$}
exiftool -IPTC:TimeCreated<CreateDate -d "%%H%%M%%S" {filepath$}

The batch does work, but ExifTool opens to read unnecessery 3 times, and I think, the original-backup will be overwritten 2 times (if all commands are clean I will take -overwrite_original).
How do I the -execute clean?

Phil Harvey

You can do all this in one command without the -execute option:

exiftool -F -Artist="Name" -IPTC:CopyrightNotice="Name" -IPTC:Writer-Editor="Name" "-Copyright<© $CreateDate Name" -IPTC:Country-PrimaryLocationName="Deutschland" -IPTC:Country-PrimaryLocationCode="DEU" "-IPTC:Keywords+<CreateDate" -d "%%Y" "-IPTC:Caption-Abstract<ImageDescription" "-IPTC:ObjectName<ImageDescription" "-IPTC:DateCreated<CreateDate#" "-IPTC:TimeCreated<CreateDate#" {filepath$}

ExifTool allows you to set date-only and time-only tags with a date/time value and it magically pulls out the appropriate string.  The # after the tag name disables the print conversion so the -d option applies only to the CreateDate used for Copyright and Keywords.

- 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 ($).

klemmleuchte

 ::) Puh, I see! Thank you!
You did a real great work with this option, but it is very hidden to me.

klemmleuchte

Still working on this commanline:
Now -execute, if I want to add "-IPTC:Keywords+< $CreateDate" -d "%%Y" ?
Or can I use the given %%Y- format in any way?

Phil Harvey

I don't understand.  My example does exactly what you are asking.

In any given command, the -d option applies to all converted date/time values.

If you need to use different date/time formatting, you need to execute 2 commands:

exiftool -d %Y "-sometag<createdate" FILE
exiftool -d %h "-anothertag<createdate" FILE


or use the -execute option to break a single command line into 2 commands:

exiftool -d %Y "-sometag<createdate" FILE -execute -d %h "-anothertag<createdate" FILE

- 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 ($).

klemmleuchte

Sorry, Phil. Don't worry.
I didn't understand that the -d-Option is guilty in the hole line.
I gessed this and tried, but it doesn't work in fact.
...will try again!
Thank you again. Sorry for irritating.

klemmleuchte

Works now!
I doubled -IPTC:Keywords and got only the last set one. I've found, that "-d %%Y -Keywords+<$CreateDate, $Model" should be used instead.

Phil Harvey

Quote from: klemmleuchte on June 02, 2010, 06:29:15 AM
Works now!
I doubled -IPTC:Keywords and got only the last set one. I've found, that "-d %%Y -Keywords+<$CreateDate, $Model" should be used instead.

No.  Do this instead:

exiftool -addTagsFromFile -d %%Y "-keywords+<createdate" "-keywords+<model" ...

The reason is mentioned at the end of FAQ 17 and in Note 4 of the -tagsFromFile documentation.

- 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 ($).

klemmleuchte

You're right! Now I understood a little of FAQ #17...
But it mades me sweat because it's the end of the flagpole for me (as we say in german). English isn't my first language...

Your example should get the "@", then it works.

exiftool  -d %%Y "-addTagsFromFile @ "-keywords+<createdate" "-keywords+<model" ...

For me now is working this big commandline:
Quoteexiftool -Description= -Artist="name" -IPTC:CopyrightNotice="name" -IPTC:Writer-Editor="name" -d "%%Y" -addTagsFromFile @ "-keywords+<createdate" "-keywords+<model" "-IPTC:copyright< © $CreateDate name" -IPTC:Country-PrimaryLocationName="Deutschland" -IPTC:Country-PrimaryLocationCode="DEU" -IPTC:DateCreated<CreateDate# -IPTC:TimeCreated<CreateDate# -IPTC:Caption-Abstract"< $ImageDescription" -IPTC:ObjectName"< $FileName" "-IPTC:Headline< $ImageDescription" -overwrite_original_in_place {filepath$}

To copy $ImageDescription to Caption.. and Headline is provisional... I will look for a better solution to shorten the ImageDescription-string.

You were very helpful to get this. Thankyou, Eike

Phil Harvey

Quote from: klemmleuchte on June 02, 2010, 12:44:32 PM
Your example should get the "@", then it works.

exiftool  -d %%Y "-addTagsFromFile @ "-keywords+<createdate" "-keywords+<model" ...

Sorry.  You are quite correct!  (Although now there is an extra quote (") in there that shouldn't be.)

- 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 ($).

klemmleuchte

Yes, I see, but it is only a rest from dirty editing the copy.
The commandline does exactly, what it should do.

Thank you for your big help. Your solutions were very interesting and I've learned to understand more. But now I need a pause.

Bye, Eike