News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Batch File To Remove All Metadata But Retain File System Dates

Started by PuppyCat, June 21, 2014, 05:47:35 AM

Previous topic - Next topic

PuppyCat

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  :)

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

PuppyCat

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  ;)



PuppyCat

Ok. Silly me I worked it out  :-[

Solution:

exiftool -all= -preserve -overwrite_original "*"