Linux Today: Linux News On Internet Time.

More on LinuxToday

TheLinuxGurus.org: Automating FTP

Aug 30, 2000, 21:34 (7 Talkback[s])


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

[ Thanks to David Culp for this link. ]

"FTP, which stands for File Transfer Protocol, is a very powerful way to transfer files from one computer system to another. Even if you don't know it, you probably have used it. If you have clicked on a file in your browser to download it from a website then it was probably transfered via FTP ( though it doesn't have to be). There are currently a slew of graphical FTP utilities to make the tedious effort of typing in those FTP commands easier. Personally, I prefer FTP from the command line, all those GUI FTP clients are really cool looking but you lose one of FTPs most powerful abilities, the ability to automate FTP. In other words, the ability to make a connection, transfer files and break the connection without you even being around."

"Exactly why would this be a good idea? OK, let us say you work in an office, and everyday you have to download the days financial report, do some form of processing on it and re-upload it. Would it not be nice to automate this task to be performed even if you are not there. Take for instance my situation, in addition to running this website (I know I don't do a good job, so sue me) I have a more than full time job of teaching science. On the front page of the site is Linux related news which I currently have to constantly peruse news sites looking for interesting news to post. This takes a lot of time and effort of which I do not always have either to spare. Most of the news sites (including the best Linux news site, Linux Today) have a back-end file you can download, parse and then post. However, most stipulate that you only download the file once every half hour, so that eliminates writing a dynamic CGI script that gets called every time a page loads. However, by writing a short script to grab the back-end files, parsing them and uploading them to my server via automating FTP and putting the whole system on a cron my problem is solved. Note: I have not finished implementing this system yet."

"The way to automate FTP is through the .netrc file. You can use any standard text editor such as vi, emacs or a GUI editor to edit .netrc...."

Complete Story

Related Stories: