# Ray Espinoza # FileCompare.pl # 2/06/02 # This script will compare a file on two different machines ################################################################## use File::stat qw(:FIELDS); my($file, $host1, $host2, $path1, $path2); print "Enter the filename and path which it resides, minus the hostname..etc. /d$/ebayconfig/confighosts.txt .."; print "\n" . "***make sure to use / instead of \ please*********"; chomp($file = ); print "Enter the first hostname of the machine you want to compare. "; chomp($host1 = ); print "Enter the other host that you want to check file properites. "; chomp($host2 = ); $path1 = "//" . $host1 . $file; $path2 = "//" . $host2 . $file; $stat = stat($path1) or die "No File :$!"; if ($st_size & $st_mtime) { $size1 = $st_size; $mtime1 = $st_mtime; } $stat = stat($path2) or die "No File :$!"; if ($st_size & $st_mtime) { $size2 = $st_size; $mtime2 = $st_mtime; } if ($size1 == $size2) { print "File size matches.\n"; }else{ print "$path1 and $path2 have different sizes!\n"; }