in reply to Duplicating the 'cp' command's '-u' switch
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Duplicating the 'cp' command's '-u' switch
by nysus (Parson) on Dec 10, 2003 at 03:17 UTC |