Generate a CreateDate for files copied from CD

Started by JanK, January 16, 2012, 01:50:12 PM

Previous topic - Next topic

JanK

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.
-Mac OSX Mountain Lion-

Phil Harvey

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
...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 ($).