Posted on 2008-11-07 06:48:00-08 by msbc
Perl equivalent of -P option
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
Direct Responses: 9251 | Write a response
Posted on 2008-11-07 11:22:02-08 by exiftool in response to 9243
Re: Perl equivalent of -P option
It's not so pretty, but here's how you do it in a Perl script:

my $modTime = $^T - (-M $file) * (24 * 3600); my $accTime = $^T - (-A $file) * (24 * 3600); [ ... process file here ... ] utime($accTime, $modTime, $file);

- Phil
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.