ExifTool Forum

ExifTool => Newbies => Topic started by: PuppyCat on June 21, 2014, 05:47:35 AM

Title: Batch File To Remove All Metadata But Retain File System Dates
Post by: PuppyCat on June 21, 2014, 05:47:35 AM
Hello

I am trying to write a Windows 7 batch file to remove all metadata from a range of file types (e.g. .jpg, .tif, pdf) but retain the file system dates (e.g. FileModifyDate, FileAccessDate, FileCreateDate) for each file.

This is the syntax I have configured so far but not all the metadata is removed and the dates all change when updated.

exiftool -all= -tagsFromFile @ -FileModifyDate= -overwrite_original *.jpg
exiftool -all= -tagsFromFile @ -FileModifyDate= -overwrite_original *.pdf
exiftool -all= -tagsFromFile @ -FileModifyDate= -overwrite_original *.png
exiftool -all= -tagsFromFile @ -FileModifyDate= -overwrite_original *.tif

I would be very grateful if someone could point me in the right direction.
Regards

PuppyCat  :)
Title: Re: Batch File To Remove All Metadata But Retain File System Dates
Post by: Phil Harvey on June 21, 2014, 06:40:09 AM
Use the -P option to preserve as many of the filesystem times as possible.  On Windows 7, this should preserve the FileModifyDate and FileCreateDate.

- Phil
Title: Re: Batch File To Remove All Metadata But Retain File System Dates
Post by: PuppyCat on June 22, 2014, 02:22:42 AM
Hi Phil

That worked perfectly. Thanks so much for your help.

I have formatted my batch file as:

exiftool -all= -preserve -overwrite_original *.jpg
exiftool -all= -preserve -overwrite_original *.pdf
exiftool -all= -preserve -overwrite_original *.png
exiftool -all= -preserve -overwrite_original *.tif

I tried to use the syntax below to force processing files with any extension, instead of listing each extension individually, but it didn't work. Any ideas on his one?

exiftool -all= -preserve -overwrite_original -ext "*" DIR

Regards

PuppyCat  ;)


Title: Re: Batch File To Remove All Metadata But Retain File System Dates
Post by: PuppyCat on June 22, 2014, 02:53:36 AM
Ok. Silly me I worked it out  :-[

Solution:

exiftool -all= -preserve -overwrite_original "*"