dcsimg
Linux Today: Linux News On Internet Time.




More on LinuxToday


TheLinuxGurus.org: Automating FTP: Part two

Oct 14, 2000, 18:08 (1 Talkback[s])

WEBINAR:
On-Demand

Re-Imagining Linux Platforms to Meet the Needs of Cloud Service Providers


[ Thanks to David Culp for this link. ]

"A few weeks ago I wrote an article on how to automate FTP via the .netrc file. I received lots of excellent feedback concerning the article, most of which to tell me other ways to automate FTP. I had aimed that article at the non-programming audience. I wanted to demonstrate a very simple way to automate your FTP logins and to automatically perform certain FTP tasks. Because the volume of mail was so high I decided to write a second part to the article to detail two other ways to automate FTP. For very simple tasks the .netrc file is probably the easiest way to go. However, for more complex tasks, or tasks needing greater error checking and flexibility you will probably want to use one of the methods outlined below. This article is not meant to be a definitive reference on any of the material covered, its primary goal is to familiarize you with the methods and give you further references to learn more."

"Using Perls NET::FTP
I have to admit, I am a PERL bigot, I love PERL and do much of my programming in PERL. Now, notice I said bigot and not god, just because I like it does not I mean I am good at it, I would say I write the worlds worst PERL code. If your wanting to do FTP with PERL then the Net::FTP module should be your first choice. Net::FTP is part of PERLs libnet package and is probably already installed on your system. In the really off chance that it is not you can head over to CPAN and get it along with easy to understand installation instructions. Net:FTP allows us to use familiar FTP commands via PERLs object oriented syntax. In order to use Net::FTP we simply have to place a use Net::FTP statement at the start of our program and make a Net::FTP object."

"Ncftp
Another simple choice we have is to use ncftp which once again is probably already installed on your system. Ncftp gives us a simple command line based interface to ftp. Note that ncftp can also be used as a shell just as regular ftp can. The two commands we are mainly concerned with are ncftpget and ncftpput. As you can probably guess these two commands are used to send and retrieve files from a specified ftp server."

Complete Story

Related Stories: