ExifTool Forum

ExifTool => Newbies => Topic started by: Inge on April 16, 2020, 08:48:00 AM

Title: Del all but date/time
Post by: Inge on April 16, 2020, 08:48:00 AM
Hello,
please excuse my bad english!
I have a folder with lot's of jpg and would like to delete all but date and time.
Me thought this would be correct?

exiftool "-all= --alldates" *.jpg

But all it does is writing "--alldates" in the Manufacturer, Modell and Software line; other lines are untouched.

Please help! Thanks a lot!
Title: Re: Del all but date/time
Post by: Phil Harvey on April 16, 2020, 09:31:56 AM
From the exiftool application documentation (https://exiftool.org/exiftool_pod.html#Tag-operations) (emphasis added):

      --TAG
            Exclude specified tag from extracted information.  Same as the -x
            option.  Group names and wildcards are permitted as described
            above for -TAG.  Once excluded from the output, a tag may not be
            re-included by a subsequent option.  May also be used following a
            -tagsFromFile option to exclude tags from being copied (when
            redirecting to another tag, it is the source tag that should be
            excluded), or to exclude groups from being deleted when deleting
            all information (eg. "-all= --exif:all" deletes all but EXIF
            information).  But note that this will not exclude individual tags
            from a group delete
(unless a family 2 group is specified, see
            note 4 below).  Instead, individual tags may be recovered using
            the -tagsFromFile option
(eg. "-all= -tagsfromfile @ -artist").

- Phil
Title: Re: Del all but date/time
Post by: Inge on April 16, 2020, 10:05:34 AM
Thanks Phil, but I'm still confused.
So what I did:

1. Copying date info to a text file:

exiftool -alldates out.txt *.jpg

2. Deleted all data:

exiftool -all= *.jpg

3. Tried to copy date back from saved file:

exiftool -tagsfromfile out.txt -alldates *.jpg

Result: Warning: No writable tags set from out.txt
    0 image files updated
   35 image files unchanged


I guess I'm lost? THX!
Title: Re: Del all but date/time
Post by: StarGeek on April 16, 2020, 10:45:10 AM
Try this
exiftool -all= -TagsFromFile @ -AllDates <FileOrDir>

This removes all the data then copies AllDates back into the file.
Title: Re: Del all but date/time
Post by: Inge on April 16, 2020, 10:51:06 AM
Thank you StarGeek! You saved my life! ;-)