Set File Creation Date from a tag

Started by Alyssa, August 21, 2014, 07:31:24 PM

Previous topic - Next topic

Alyssa

Hello
I was wondering if I could change the file creation date using a tag's information. I myself I have stored in every jpg file its original creation date in the comments tag(more recently this was automated thanks to ExifTool), only problem it seems to be that the DDMMYYYY format I use isn't readable, since its not the standard YYYYMMDD format, and I don't known how to make exiftool read it.

Originally the date creation date in the comments tag its stored as
DD/MM/YYYY Custom Text HH:MM:SS[Day]

With a simple script I made I copied & altered it in the subject tag by removing the unnecessary elements to make it easier to read:

C:\exiftool.exe -overwrite_original -P -E -k "-exif:xpsubject<${exif:XPComment;s/ Custom / /;s/\://;s/\://;s/\///;s/\///;s/\[Luned&igrave;\]//;s/\[Marted&igrave;\]//;s/\[Mercoled&igrave;\]//;s/\[Gioved&igrave;\]//;s/\[Venerd&igrave;\]//;s/\[Sabato\]//;s/\[Domenica\]//}" .

To make it like this DDMMYYYY HHMMSS, then I tried to:

C:\exiftool.exe -P -k "-filecreatedate<exif:xpsubject" .

But it doesn't work as the DDMMYYYY format isn't the default format. Is there a way to make ExifTool read the DDMMYYYY format or as workaround, is there a command that could switch places (e.g. DD in the YYYY place), to make it readable?

Thanks.

Phil Harvey

You should be able to do this:

exiftool "-filecreatedate<${exif:xpcomment;s[(\d{2})/(\d{2})/(\d{4})][$3/$2/$1]}" .

You shouldn't need to remove the unnecessary text.  Note I have used square braces for the substitution expression delimiters just because the expression contained slashes.  In Perl, you are free to choose whatever delimiters you want (any non-alphanumeric, non-whitespace character is allowed).

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

Alyssa

Wow, I am really astonished this can be done with a single command without having to convert my date time's format.
Again the power of Exiftool its really outstanding, thanks once again for the help that was simply awesome!