Author Topic: Batch File To Remove All Metadata But Retain File System Dates  (Read 1713 times)

PuppyCat

  • Newbie
  • *
  • Posts: 3
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16885
    • ExifTool Home Page
Re: Batch File To Remove All Metadata But Retain File System Dates
« Reply #1 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

PuppyCat

  • Newbie
  • *
  • Posts: 3
Re: Batch File To Remove All Metadata But Retain File System Dates
« Reply #2 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  ;)



PuppyCat

  • Newbie
  • *
  • Posts: 3
Re: Batch File To Remove All Metadata But Retain File System Dates
« Reply #3 on: June 22, 2014, 02:53:36 AM »
Ok. Silly me I worked it out  :-[

Solution:

exiftool -all= -preserve -overwrite_original "*"