#!/usr/bin/perl -w use File::Copy; $client = ""; $server = ""; @client = stat($client); @server = stat($server); ($sec, $min, $hours, $mday, $month, $year) = (localtime($client[9]))[0..5]; printf ("Modify date and time on $client is: %02d-%02d-%04d %02d:%02d:%02d\n", $month+1, $mday, $year+1900, $hours, $min, $sec); ($sec, $min, $hours, $mday, $month, $year) = (localtime($server[9]))[0..5]; printf ("Modify date and time on $server is: %02d-%02d-%04d %02d:%02d:%02d\n\n", $month+1, $mday, $year+1900, $hours, $min, $sec); if ($client[9] < $server[9]) { print "$client is old!\n"; print "Copying new file!\n"; copy ($server, $client) or die "copy failed: $!\n"; print "$client updated!\n"; }else{ print "$client is up to date\n"; print "No files copied!\n"; }