ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: JanK on January 16, 2012, 01:50:12 PM

Title: Generate a CreateDate for files copied from CD
Post by: JanK on January 16, 2012, 01:50:12 PM
What is the best way to generate a CreateDate for all my images on Mac. Some pictures for example copied from a CD does not have an CreateDate in the filesystem. The CreateDate will be generated when I rewrite the file on my filesystem (HFS+). Until now I use exiftool -DateTimeOriginal+=1 FILENAME and exiftool -DateTimeOriginal-=1 FILENAME to process a rewrite of the file. (We spoke about that) But is there a better way for creating a CreateDate (that is the date time of the rewriting) maybe something without exiftool? I will set the command for over 6000 images.
Title: Re: Generate a CreateDate for files copied from CD
Post by: Phil Harvey on January 16, 2012, 02:24:23 PM
Hi JanK,

I just ran some tests. To reset the filesystem modification date, "touch" may be used:

touch FILE

Both the filesystem creation date and the filesystem modification date may be reset by copying the file:

rm DEST
cp FILE DEST
mv DEST FILE


Note the first "rm" is necessary because if DEST exists, the creation date will be taken from this file.

You can do this for a pile of images via a shell script.  Maybe something like this:

#!/bin/sh
rm -f "test$$.tmp"
while [ $# -gt 0 ]
do
  cp -i "$1" "test$$.tmp"
  mv "test$$.tmp" "$1"
  shift
done


- Phil