The following is a Perl script that can be used to connect to and list an FTP directory.
This can be extended to accept the paremeters as required - host ip,user password, directory etc.
This also can be run in a loop or from cron to monitor connectivity or to monitor file movements(that is a not so good use!!)
use Net::FTP; 
$host = '1x2.1xx.xx.xxx'; 
$user = 'User'; 
$pass = 'xxxxxxxxxxx'; 
$home = '/home/release; 
print "Connecting..."; 
#connect 
$ftp = Net::FTP->new($host); 
#login 
$ftp->login($user,$pass); 
print "LoggedIn..."; 
#slurp 
@result = $ftp->ls($home); 
print "\nResult..."; 
for(@result) 
{ print "\n"; 
print $_; } 
$ftp->quit; 
print "\n...Closed";
This is intended to be a notepad on which I scribe the technologies and experience - that I come across daily. Something that I can refer later. And if it helps anyone on the internet, I would be really happy. Post your comments and suggestions. Also anything you would like to know about. Will try my best to post it. Anything goes - Architecture, design, Java, J2EE, Groovy, Grails, Linux, Solaris, Weblogic, IBM MQ, Networking, Security, Compliance(PCI, SAS-70)
Subscribe to:
Post Comments (Atom)
 
 
No comments:
Post a Comment