use strict; use warnings; my $from = "first.txt"; my $to = "new.txt"; copy_if_newer($from, $to); sub copy_if_newer { my ($from, $to) = @_; # test for file modification time return 0 if (stat $from)[9] <= (stat $to)[9]; # do the actual file copy here with File::Copy, etc. # return 1 to indicate success return 1; }
In reply to Re: Duplicating the 'cp' command's '-u' switch
by Roger
in thread Duplicating the 'cp' command's '-u' switch
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |