ExifTool Forum

ExifTool => Newbies => Topic started by: matt on October 08, 2014, 09:13:07 PM

Title: Modify tag value before using?
Post by: matt on October 08, 2014, 09:13:07 PM
Hi....   Suppose I need to rename MTS files and change their filesystem modify timestamp based on their DateTimeOriginal tag plus 1 hour, without actually writing the DateTimeOriginal tag (which is not writable).   Is there a simple command-line way to do something like:


# my pseudo code:
exiftool  "-filename<${DateTimeOriginal+1}"   "-filemodifydate<${DateTimeOriginal+1}"   blah.mts


Or do I need to use a config file (like the guy a few months ago who wanted to compute the ages of his kids)?

I know it can be done in perl using Image::ExifTool but a command-line method would be cleaner.

Thanks!
Title: Re: Modify tag value before using?
Post by: Phil Harvey on October 09, 2014, 07:06:46 AM
Doing date/time adjustments is possible, but if you then want the time formatted it could be tricky.  But a 3-step process would do it:

exiftool "-filemodifydate<datetimeoriginal" -execute -filemodifydate+=1 -execute "-filename<filemodifydate" -d SOME_DATE_FORMAT -common_args blah.mts

- Phil
Title: Re: Modify tag value before using?
Post by: matt on October 09, 2014, 10:42:16 PM
Thank you very much... it worked perfectly!  Moreover, your command line was very educational --- it taught me a few things about exiftool's abilities and syntax.

Thanks again!

-Matt

Edit:  BTW, I actually ended up not needing to increment DateTimeOriginal by an hour after all, since it seems writing to FileModifyDate does a conversion to local time, whereas writing to FileName does not, and the combination of these two behaviors worked in my favor in this case (since my problem was simply the wrong TZ set in the files).