ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: klemmleuchte on May 28, 2010, 11:14:08 AM

Title: Several -d in one commandline
Post by: klemmleuchte on May 28, 2010, 11:14:08 AM
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?
Title: Re: Several -d in one commandline
Post by: Phil Harvey on May 28, 2010, 12:10:45 PM
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
Title: Re: Several -d in one commandline
Post by: klemmleuchte on May 30, 2010, 05:23:18 PM
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?
Title: Re: Several -d in one commandline
Post by: Phil Harvey on May 31, 2010, 07:23:19 AM
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
Title: Re: Several -d in one commandline
Post by: klemmleuchte on May 31, 2010, 11:27:10 AM
 ::) Puh, I see! Thank you!
You did a real great work with this option, but it is very hidden to me.
Title: Re: Several -d in one commandline
Post by: klemmleuchte on June 01, 2010, 12:57:41 PM
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?
Title: Re: Several -d in one commandline
Post by: Phil Harvey on June 01, 2010, 01:17:06 PM
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
Title: Re: Several -d in one commandline
Post by: klemmleuchte on June 01, 2010, 01:26:54 PM
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.
Title: Re: Several -d in one commandline
Post by: 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.
Title: Re: Several -d in one commandline
Post by: Phil Harvey on June 02, 2010, 07:22:41 AM
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 (https://exiftool.org/faq.html#Q17) and in Note 4 of the -tagsFromFile documentation.

- Phil
Title: Re: Several -d in one commandline
Post by: klemmleuchte on June 02, 2010, 12:44:32 PM
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
Title: Re: Several -d in one commandline
Post by: Phil Harvey on June 02, 2010, 02:23:38 PM
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
Title: Re: Several -d in one commandline
Post by: klemmleuchte on June 03, 2010, 06:05:30 PM
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