ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: zenyo on June 17, 2016, 05:42:34 AM

Title: -if and Datetimeoriginal
Post by: zenyo on June 17, 2016, 05:42:34 AM
First of all sorry for my bad english.

ExifTool helped me very much.but also a lot of things I do not understand about this software.

i got alot of pictures which DateTaken are "2222/1/1" and mixed which other date (check attachment)

is it possible to change date "2222/1/1" to "1994/6/17" using -if command

Thanks you
Title: Re: -if and Datetimeoriginal
Post by: Phil Harvey on June 17, 2016, 06:33:23 AM
Try this:

exiftool -if "$datetimeoriginal=~/^2222:01:01/" -datetimeoriginal="1994:06:17 00:00:00" DIR

- Phil
Title: Re: -if and Datetimeoriginal
Post by: zenyo on June 17, 2016, 12:49:37 PM
i tried with windows console and it's work. how ever i tried with -stay_open True @ it doesn't work here what i type in text file
-overwrite_original
-if "$datetimeoriginal=~/^2222:01:01/" -datetimeoriginal="1994:06:17 00:00:00"
C:\test\1.jpg
-execute


it's always say Warning : Tag if does not exist
Title: Re: -if and Datetimeoriginal
Post by: Phil Harvey on June 17, 2016, 05:11:32 PM
OK then, you need to find out what date/time tag to use.  Run this command on a file to see what is available:

exiftool -time:all -a -G1 FILE

- Phil
Title: Re: -if and Datetimeoriginal
Post by: StarGeek on June 17, 2016, 05:37:54 PM
The Windows "Date Taken" property is filled from these tags, in this order:
EXIF:DateTimeOriginal
IPTC:DateCreated + IPTC:TimeCreated
XMP:CreateDate
EXIF:CreateDate
XMP:DateTimeOriginal

Title: Re: -if and Datetimeoriginal
Post by: zenyo on June 18, 2016, 08:28:47 AM
hello.

this is what i enter in cmd

exiftool -stay_open True -@ C:\\test\\test.arg -fast3

in test.arg i write

-overwrite_original
-if
"$datetimeoriginal=~/^2222:01:01/" -datetimeoriginal="1994:12:12 00:00:00"
C:\test\1.JPG
-execute


it's always say 1 files failed condition.File 1.jpg date taken are 2222/01/01

if i enter Phil's command it's work just fine
exiftool -if "$datetimeoriginal=~/^2222:01:01/" -datetimeoriginal="1994:06:17 00:00:00" DIR
please help

Title: Re: -if and Datetimeoriginal
Post by: StarGeek on June 18, 2016, 12:22:58 PM
Remove the -fast3

From the docs (http://www.exiftool.org/exiftool_pod.html#fast_num).
"-fast3 avoids processing the file entirely, and returns only an initial guess at FileType and the pseudo System tags"
Title: Re: -if and Datetimeoriginal
Post by: zenyo on June 18, 2016, 01:12:43 PM
i removed -fast3 option but the console output still give me "1 files failed condition" error
Title: Re: -if and Datetimeoriginal
Post by: ryerman on June 18, 2016, 02:23:02 PM
The arg file format is incorrect.
http://www.exiftool.org/exiftool_pod.html#other_options (http://www.exiftool.org/exiftool_pod.html#other_options)
From the documentation:
"The file contains one argument per line (NOT one option per line -- some options require additional arguments, and all arguments must be placed on separate lines)"

Try this:
-overwrite_original
-if
"$datetimeoriginal=~/^2222:01:01/"
-datetimeoriginal="1994:12:12 00:00:00"
C:\test\1.JPG
-execute
Title: Re: -if and Datetimeoriginal
Post by: zenyo on June 18, 2016, 11:49:27 PM
thanks ryerman it's work now


-overwrite_original
-if
$datetimeoriginal=~/^2222:01:01/
-datetimeoriginal="1994:12:12 00:00:00"
C:\test\1.JPG
-execute

again thanks you guys so much

btw how can i change hours in Date Taken without touching year/month/day
Title: Re: -if and Datetimeoriginal
Post by: ryerman on June 19, 2016, 10:42:21 AM
Quote from: zenyo on June 18, 2016, 11:49:27 PM
btw how can i change hours in Date Taken without touching year/month/day
Try this:
exiftool "-datetimeoriginal<${datetimeoriginal;s/(\d\d\d\d:\d\d:\d\d)(.+)/$1 HH:MM:SS/}" "Your File.jpg"
where HH, MM, SS are whatever hour, minute and seconds you want.

You can use Perl substitution operations (Regular Expressions) to modify the value of any tag.
Search the forum (using "regex") for examples, and see the documentation for the -p option.