Change DATE only in datetimeoriginal

Started by damage, January 02, 2014, 06:08:34 AM

Previous topic - Next topic

damage

I would like to change a DATE part of datetimeoriginal and not the TIME. The DATE should come from a directory name. So far I came only to the solution, where I can reset time like this:

exiftool "-datetimeoriginal<${directory} 00:00:00" -r <path>

Is it possible to change DATE only and leave the TIME part intact?

The camera had the wrong date set, but not on all images in a subdirectories (there are hundreds of them). The directory names have all the correct date like "20130102 desc".

Phil Harvey

You could do it using the advanced formatting feature, like this:

exiftool "-datetimeoriginal<${directory} ${datetimeoriginal;s/.* //}" -r <path>

However, this will only work if the directory name doesn't contain any other numbers.  If it does, it would be necessary to do some formatting of the directory tag as well.

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

damage


kzoppo

Maybe I am missing something but I get this when I try to do this

-bash: ${datetimeoriginal;s/.* //}': bad substitution

am I supposed to be changing any of this information? I am new and I can do what I want this way but what I really want to do is just change the date and leave the time without any directories involved. I've been searching but can't figure this out!

Thank you

Phil Harvey

On Mac/Linux you must use single quotes instead of double quotes around any argument containing a '$' symbol.

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

kzoppo

When I received the error I had input this

exiftool '-datetimeoriginal<${directory} ${datetimeoriginal;s/.* //}' -r <path>

Should I place more '?

Alan Clifford

Quote from: kzoppo on March 01, 2014, 07:30:39 AM
When I received the error I had input this

exiftool '-datetimeoriginal<${directory} ${datetimeoriginal;s/.* //}' -r <path>

Should I place more '?

'-datetimeoriginal - you've got a erroneous quote glyph there.

kzoppo

Ok, if I understand correctly you are telling me to input this

exiftool 'datetimeoriginal<${directory} ${datetimeoriginal;s/.* //}' -r <path>

But I still get the same error. Basically all I want to do is change the date of a photo but leave the time intact. I want to input the date, not refer it to a different location. I'm sure there is an easy solution but I don't know it.

Thanks

Phil Harvey

No, I think Alan was telling you to use ' instead of ' and '.  Command shells only respond to simple ASCII quotes:

exiftool '-datetimeoriginal<${directory} ${datetimeoriginal;s/.* //}' -r <path>

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

kzoppo

Ah ok I understand. Thank you. I input this

exiftool '-datetimeoriginal<${directory} ${datetimeoriginal;s/.* //}' -r

and it says that 1 file has been changed but when I look at all the dates

exiftool -time:all -a -G0:1 -s

They don't seem to have changed. I have also tried replacing directory with a date and I get

    0 image files updated
    1 image files unchanged

Phil Harvey

Add the -v2 option to see the details about what was changed.

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

kzoppo

Do you know how I can change the date on a file while leaving the time intact? I don't want the date to be referred to a different directory, I just want to input the date and leave the time unchanged.

Thanks

Phil Harvey

Then the command would look like this:

exiftool '-datetimeoriginal<2014:03:02 ${datetimeoriginal;s/.* //}' FILE

where FILE is the name of your file or directory.

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

kzoppo


orbspider

Hi,

I want to something similar, but with -AllDates tag

I tried exiftool -m '-AllDates=2014:04:05 ${AllDates;s/.* //}' file

to no avail.  IMHO, the ${....} is complicated.  I would find exiftool easier to use if we could specify the date part or time with a tag, e.g.

exiftool -date -AllDates='2014:04:05' file
or
exiftool -time -AllDates='12:10:40' file

but maybe the tag has to follow, like
exiftool -AllDates='2014:04:05' -d file

I also tried
exiftool -date -AllDates='2014:04:05 0:0:0' file
as logically this should leave the time unchanged, but it returned "0 image files updated"

Am I missing something? cheers