in reply to stat and localtime
Everyone,
Thanks for your help. Here is what I have finished. Yes, I'm sure there is a way to improve on this. If anyone has any ideas let me know. But, this works.
Thanks.
#!/usr/bin/perl -w use File::Copy; $client = "<any drive mapping to a file, either locally or network>"; $server = "<any drive mapping to a file, either locally or network>"; + @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"; }
Thanks again for the help! Everyone out here is wonderful!
Curtib
has a small clue now.....
|
|---|