#!/usr/local/bin/perl -w # script by Stef Caunter April 2002 # checks file timestamps on remote hosts # ftp is insecure! use only on lans and trusted networks # don't leave this file world readable, eh? # nice way to timestamp non-local files for webservers # stef@caunter.ca use Net::FTP; use CGI ':standard'; use strict; my ($file, $hostname, $username, $password, $ftp, @result, @details); # fill in the blanks, eh? $hostname = 'foo.bar.com'; $username = 'user'; $password = 'pass'; $file = '/path/to/file'; $ftp = Net::FTP->new($hostname); #open an ftp connection to server $ftp->login($username, $password); #login to the server @result = $ftp->dir("$file"); open (FH, ">fh")||die "eh, $!\n"; print FH "@result"; close FH; open (FH, "fh")||die "eh, $!\n"; $_ = ; s/ +/ /g; @details = split(/ /, $_); print "$file last updated on $details[5] $details[6] at $details[7].\n"; `rm fh`;