blob: ceef109733b85d879c9a72091b52b4ce017b2b3d [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001use strict;
2use Time::HiRes qw(stat);
3
4my $input = $ARGV[0];
5my $output = $ARGV[1];
6
7if (! -e $input)
8{
9 die "Fail to find input: $input";
10}
11elsif(! -e $output)
12{
13 die "Fail to find output: $output";
14}
15
16my @st_in = stat($input);
17if (@st_in)
18{
19 my $permit = $st_in[2] & 07777;
20 my $atime = int($st_in[8]);
21 if ($st_in[8] > $atime)
22 {
23 $atime += 1;
24 }
25 my $mtime = int($st_in[9]);
26 if ($st_in[9] > $mtime)
27 {
28 $mtime += 1;
29 }
30 chmod($permit, $output);
31 utime($atime, $mtime, $output);
32}
33