ExifTool Forum

ExifTool => Newbies => Topic started by: joe.king.cool on February 06, 2022, 04:57:34 PM

Title: Clear All metadata from jpg, then update all times to a custom date then rename
Post by: joe.king.cool on February 06, 2022, 04:57:34 PM
Hello all!

I am working on making a tool, where you select the folder and type a date in.

1. remove all metadata from jpg in that folder
exiftool -all= *.jpg

2. update datetaken modifeddate originaldate createdate or any other date fields, too a custom date

3. rename pictures from the date taken "i found a command for jhead, but was wondering if can be done with exiftool"

4. create a folder with that date, then move them into that folder. "i can program this but wanted to see if its built in to exiftool"



the main reason im doing this, is because plex media center has trouble with photos in a timeline. many of there users have been irate for years about this, so i am on a quest to make it simple for software like that to put in a timeline.

Many thanks!  :)
Title: Re: Clear All metadata from jpg, then update all times to a custom date then rename
Post by: StarGeek on February 06, 2022, 06:37:13 PM
Quote from: joe.king.cool on February 06, 2022, 04:57:34 PM
1. remove all metadata from jpg in that folder
exiftool -all= *.jpg

Personally, I would suggest not removing all data.  There really isn't a reason to.  Removing AllDates, which removes the main three time stamp tags would be enough.

Quote2. update datetaken modifeddate originaldate createdate or any other date fields, too a custom date

AllDates will edit DateTimeOriginal, CreateDate, and ModifyDate.  There's no such thing as a "Date Taken" tag.  In most cases, it's data filled from one of the three tags just mentioned.  You would also include the file system time stamps, FileCreateDate and FileModifyDate..

An example command would be
exiftool -AllDates=<insert date> -FileCreateDate=<insert date> -FileModifyDate=<insert date> /path/to/files/

Quote3. rename pictures from the date taken "i found a command for jhead, but was wondering if can be done with exiftool"

4. create a folder with that date, then move them into that folder. "i can program this but wanted to see if its built in to exiftool"

This would depend upon the exact format you would want to use, but the basic idea would be to use the -d (-dateFormat) option (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat).  Also see the docs under Renaming Examples (https://exiftool.org/exiftool_pod.html#RENAMING-EXAMPLES) and Common Date Format Codes (https://exiftool.org/filename.html#codes).
exiftool -d /path/to/top/%Y/%m/%Y-%m-%d_%H.%M.%S%%+c.%%e /path/to/files/

Quotethe main reason im doing this, is because plex media center has trouble with photos in a timeline. many of there users have been irate for years about this, so i am on a quest to make it simple for software like that to put in a timeline.

I've never used Plex to look at images, but if I can find time, I'll narrow down what tags Plex will actually read.  I've done some testing with videos before and there weren't many tags that Plex would read.
Title: Re: Clear All metadata from jpg, then update all times to a custom date then rename
Post by: joe.king.cool on February 06, 2022, 06:54:53 PM
Thanks so much! very helpful, let me tinker a little with it, and ill get back to you. :)
Title: Re: Clear All metadata from jpg, then update all times to a custom date then rename
Post by: joe.king.cool on February 06, 2022, 07:11:05 PM
i tried the following 2 ways to change the dates, but its not changing the dates. Do i have to put a time in there for each date? and since im on windows, is the directory in correct format?

exiftool -AllDates=2003:01:05 -FileCreateDate=2003:01:05 -FileModifyDate=2003:01:05  C:\Users\user\Desktop\test
--Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in File:FileCreateDate (PrintConvInv)---

exiftool -AllDates=2003:01:05 03:33:33 -FileCreateDate=2003:01:05 03:33:33 -FileModifyDate=2003:01:05 03:33:33 C:\Users\user\Desktop\test 
-----it is giving me an error saying   "Error: File not found - 03:33:33"-------





Title: Re: Clear All metadata from jpg, then update all times to a custom date then rename
Post by: joe.king.cool on February 06, 2022, 07:55:11 PM
i did this and it changed only the taken date in windows

exiftool "-AllDates=2003:02:05 03:33:33" C:\Users\user\Desktop\test\

Title: Re: Clear All metadata from jpg, then update all times to a custom date then rename
Post by: joe.king.cool on February 06, 2022, 08:24:28 PM
this works now, not sure why it didnt earlier, but im on windows 10, so who knows  :)

exiftool "-DateTimeOriginal=2007:07:07 03:33:33" "-FileCreateDate=2007:07:07 03:33:33" "-FileModifyDate=2007:07:07 03:33:33" C:\Users\user\Desktop\test\

I had to change this one a little. 
exiftool -d "C:\Users\user\Desktop\top\%Y-%m-%d_%%+c.%%e" "-filename<DateTimeOriginal"  C:\Users\user\Desktop\test\


Everything works like charm! fantastic program! Thanks so much StarGeek!!
Title: Re: Clear All metadata from jpg, then update all times to a custom date then rename
Post by: StarGeek on February 07, 2022, 12:19:19 PM
I did a quick test and my initial guess is correct.  The AllDates is the tag you want to use and it is specifically reading the DateTimeOriginal tag, which is part of AllDates.

I'll have to dig in a bit more, but Plex is reading the following
IPTC:ObjectName for the Title
EXIF:DateTimeOriginal for the Capture Time
EXIF:ImageDescription for the Summary

The fact that it will read data for Title and Summary is a good reason not to clear all metadata.

I'll have to do a bit more testing to see what else it reads, but I suspect that it will fall back on the file system time stamps if DateTimeOriginal doesn't exist, which is probably the source of the problem you are having.  I'm also guessing that if EXIF:ImageDescription doesn't exist, it will read IPTC:Caption-Abstract.

Also, it does not read any keywords from the file to fill in the Tags page

(https://i.imgur.com/jowFBdn.png)

(https://i.imgur.com/1SJsw4Q.png)