ExifTool Forum

ExifTool => Archives => Topic started by: Archive on May 12, 2010, 08:54:27 AM

Title: Perl equivalent of -P option
Post by: Archive on May 12, 2010, 08:54:27 AM
[Originally posted by msbc on 2008-11-07 06:48:00-08]

Phil,

I'm writing a Perl script to update a bunch of tags in some images. I know the -P can be used on the command line to preserve FileModifyDate but I can't work out how to achieve this in a script?

Mark
Title: Re: Perl equivalent of -P option
Post by: Archive on May 12, 2010, 08:54:27 AM
[Originally posted by exiftool on 2008-11-07 11:22:02-08]

It's not so pretty, but here's how you do it in a Perl script:

Code:
my $modTime = $^T - (-M $file) * (24 * 3600);
my $accTime = $^T - (-A $file) * (24 * 3600);

[ ... process file here ... ]

utime($accTime, $modTime, $file);

- Phil