Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl $dir1 = "/root/test1"; # Checkout Dir $dir2 = "/root/test2"; # CVS opendir(BIN, $dir1) or die "Can't open $dir: $!"; while ( defined ($file = readdir BIN) ) { push(@fl,$file) unless $file =~ /^\.\.?$/; } closedir(BIN); foreach $key(@fl) { if(! -e "$dir2/$key") { system (`cp "$dir1/$key" "$dir2/$key"`); } else { $cvs_modi = (stat("$dir1/$key"))[9]; $client_modi = (stat("$dir2/$key"))[9]; if($cvs_modi > $client_modi) { system(`cp "$dir1/$key" "$dir2/$key"`); } else { print "No need to copy.\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cvs checkin sample code
by Mutant (Priest) on Oct 20, 2004 at 14:24 UTC | |
by Anonymous Monk on Oct 20, 2004 at 14:36 UTC | |
by Mutant (Priest) on Oct 20, 2004 at 14:45 UTC | |
by Anonymous Monk on Oct 20, 2004 at 15:06 UTC | |
|
Re: cvs checkin sample code
by tachyon (Chancellor) on Oct 21, 2004 at 08:48 UTC | |
|
Re: cvs checkin sample code
by trammell (Priest) on Oct 20, 2004 at 14:56 UTC | |
by Anonymous Monk on Oct 20, 2004 at 15:07 UTC |