I have a lot of fotos in several folders. Some of them don't have the "DateTimeOriginal" tag. So when I load them up to OneDrive it's a mess because they have some invented dates then.
Therefore I wan't to correct all missing "DateTimeOriginal" tags.
In the filename there is a date which I can use and like to copy into the "DateTimeOriginal" tag.
I tried it with two example files
000603 000 Beer.jpg doesn't contain tag
000611 003 Beer.jpg contains tag
The first 6 digits are the date: "YYMMDD".
I went through the forum and tried several comands but none of them worked for me.
I'm working with Windows 10 and when I check the example files with:
exiftool -time:all -g1 -a -s *.jpg
I get
======== 000603 000 Beer.jpg
---- System ----
FileModifyDate : 2000:06:03 09:59:58+02:00
FileAccessDate : 2022:09:14 16:08:37+02:00
FileCreateDate : 2022:09:14 11:19:36+02:00
======== 000611 003 Beer.jpg
---- System ----
FileModifyDate : 2000:06:11 19:51:26+02:00
FileAccessDate : 2022:09:14 16:08:37+02:00
FileCreateDate : 2022:09:14 11:19:36+02:00
---- IFD0 ----
ModifyDate : 2000:06:11 18:51:27
---- ExifIFD ----
DateTimeOriginal : 2000:06:11 18:51:27
CreateDate : 2000:06:11 18:51:27
2 image files read
Then I want to copy the date with
exiftool -if "not $DateTimeOriginal" "-DateTimeOriginal<20:${filename;$_=substr($_,0,2)}:01:01 12:00:00" *.jpg
And get the warning
Warning: No writable tags set from 000603 000 Beer.jpg
1 files failed condition
0 image files updated
1 image files unchanged
Does anyone could help on where my error is? After some hours reading and trying I don't know how to come further... :-[
Hi Bernie,
Quote from: Bernie on September 14, 2022, 10:40:35 AMexiftool -if "not $DateTimeOriginal" "-DateTimeOriginal<20:${filename;$_=substr($_,0,2)}:01:01 12:00:00" *.jpg
You have an extra colon. Also, this will set the month:day to 01:01. Maybe try this:
exiftool -if "not $DateTimeOriginal" "-DateTimeOriginal<20${filename;$_=substr($_,0,6)} 12:00:00" -ext jpg .
This should take the YYMMDD from the filename. FAQ 5 (https://exiftool.org/faq.html#Q5) may help you see why this works. Also, I've changed it to use the -ext option instead of wildcards in the file name (see common mistake number 2 (https://exiftool.org/mistakes.html#M2)).
- Phil
Hi Phil,
thanks a lot! And of course it works now ;D
Incredible to be so close to the solution...
Now I try to increase the TIME by about 10 min.
Tried to figure out from here how to do it:
Batch changing EXIF date/time (https://exiftool.org/forum/index.php?msg=37341)
But somehow it doesn't work for my needs. :o
What command did you use, and how didn't it work? What exactly are you trying to do?
- Phil
Good morning Phil,
today it works.
It increases the seconds by one, instead of increasing the minutes. Not exactly what I wanted, but it works for me. :)
Why? I don't now. Perhaps because today I'm running under Linux? No idea.
I added a subdirectory and some more files to have a more realistic test environment.
The Beer-files are the one without timestamp. The Wine-files have one.
I'm using the command:
exiftool -if 'not $DateTimeOriginal' '-DateTimeOriginal<20${filename;$_=substr($_,0,6)} 12:-datetimeoriginal+<0:${filesequence}:00' -r -ext jpg .
Before the modification with exiftools the result looks like this:
======== ./000603 000 Beer.jpg
---- System ----
FileModifyDate : 2000:06:03 09:59:58+02:00
FileAccessDate : 2022:09:14 19:15:50+02:00
FileInodeChangeDate : 2022:09:15 08:39:33+02:00
======== ./000611 003 Wine.jpg
---- System ----
FileModifyDate : 2000:06:11 19:51:26+02:00
FileAccessDate : 2022:09:14 19:15:50+02:00
FileInodeChangeDate : 2022:09:15 08:19:38+02:00
---- IFD0 ----
ModifyDate : 2000:06:11 18:51:27
---- ExifIFD ----
DateTimeOriginal : 2000:06:11 18:51:27
CreateDate : 2000:06:11 18:51:27
======== ./Subfolder/000603 001 Beer.jpg
---- System ----
FileModifyDate : 2000:06:03 09:59:32+02:00
FileAccessDate : 2022:09:14 19:16:22+02:00
FileInodeChangeDate : 2022:09:15 08:39:53+02:00
======== ./Subfolder/000611 001 Wine.jpg
---- System ----
FileModifyDate : 2022:09:14 08:13:27+02:00
FileAccessDate : 2022:09:14 19:16:22+02:00
FileInodeChangeDate : 2022:09:15 08:19:00+02:00
---- IFD0 ----
ModifyDate : 2000:06:11 18:50:41
---- ExifIFD ----
DateTimeOriginal : 2000:06:11 18:50:41
CreateDate : 2000:06:11 18:50:41
SubSecTimeOriginal : 00
SubSecTimeDigitized : 00
---- XMP-xmp ----
CreateDate : 2000:06:11 18:50:41
---- Composite ----
SubSecCreateDate : 2000:06:11 18:50:41.00
SubSecDateTimeOriginal : 2000:06:11 18:50:41.00
======== ./Subfolder/000611 002 Wine.jpg
---- System ----
FileModifyDate : 2000:06:11 19:50:56+02:00
FileAccessDate : 2022:09:14 19:16:22+02:00
FileInodeChangeDate : 2022:09:15 08:19:08+02:00
---- IFD0 ----
ModifyDate : 2000:06:11 18:50:58
---- ExifIFD ----
DateTimeOriginal : 2000:06:11 18:50:58
CreateDate : 2000:06:11 18:50:58
2 directories scanned
5 image files read
After modification the seconds of the Beer-files are increased. It counts the Wine-files also but that is no problem for me:
======== ./000603 000 Beer.jpg
---- System ----
FileModifyDate : 2022:09:15 08:40:26+02:00
FileAccessDate : 2022:09:15 08:40:31+02:00
FileInodeChangeDate : 2022:09:15 08:40:26+02:00
---- ExifIFD ----
DateTimeOriginal : 2000:06:03 12:00:01
======== ./000611 003 Wine.jpg
---- System ----
FileModifyDate : 2000:06:11 19:51:26+02:00
FileAccessDate : 2022:09:14 19:15:50+02:00
FileInodeChangeDate : 2022:09:15 08:19:38+02:00
---- IFD0 ----
ModifyDate : 2000:06:11 18:51:27
---- ExifIFD ----
DateTimeOriginal : 2000:06:11 18:51:27
CreateDate : 2000:06:11 18:51:27
======== ./Subfolder/000603 001 Beer.jpg
---- System ----
FileModifyDate : 2022:09:15 08:40:27+02:00
FileAccessDate : 2022:09:15 08:40:27+02:00
FileInodeChangeDate : 2022:09:15 08:40:27+02:00
---- ExifIFD ----
DateTimeOriginal : 2000:06:03 12:00:04
======== ./Subfolder/000611 001 Wine.jpg
---- System ----
FileModifyDate : 2022:09:14 08:13:27+02:00
FileAccessDate : 2022:09:14 19:16:22+02:00
FileInodeChangeDate : 2022:09:15 08:19:00+02:00
---- IFD0 ----
ModifyDate : 2000:06:11 18:50:41
---- ExifIFD ----
DateTimeOriginal : 2000:06:11 18:50:41
CreateDate : 2000:06:11 18:50:41
SubSecTimeOriginal : 00
SubSecTimeDigitized : 00
---- XMP-xmp ----
CreateDate : 2000:06:11 18:50:41
---- Composite ----
SubSecCreateDate : 2000:06:11 18:50:41.00
SubSecDateTimeOriginal : 2000:06:11 18:50:41.00
======== ./Subfolder/000611 002 Wine.jpg
---- System ----
FileModifyDate : 2000:06:11 19:50:56+02:00
FileAccessDate : 2022:09:14 19:16:22+02:00
FileInodeChangeDate : 2022:09:15 08:19:08+02:00
---- IFD0 ----
ModifyDate : 2000:06:11 18:50:58
---- ExifIFD ----
DateTimeOriginal : 2000:06:11 18:50:58
CreateDate : 2000:06:11 18:50:58
2 directories scanned
5 image files read
Thanks a lot for your support and have a nice day!
hmmm. Doesn't work like I expected.
When there are more than 60 pictures to edit I get an error because numbers higher than 60 can't be entered as seconds. :-\
I have to think about something else which increases minutes and seconds...
You have to use a two step procedure. One command to set the base time, then another command to shift by seconds.
See this post (https://exiftool.org/forum/index.php?topic=5621.msg27394#msg27394).