Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-04-2007, 09:05 PM   #1
LQ Newbie
Registered: Feb 2006
Posts: 20

Rep: Reputation: 0
FTP Command Line (Scripting Multiple FTP gets)

Is it possible to automate FTP Gets via command line use of FTP and a script?

Today="`date +%y%m%d`"
FTP remote.ip.address.1 user=UserName pwd=PassWord get remoteFile Site.1.LocalFile.$Today
FTP remote.ip.address.2 user=UserName pwd=PassWord get remoteFile Site.2.LocalFile.$Today
FTP remote.ip.address.3 user=UserName pwd=PassWord get remoteFile Site.3.LocalFile.$Today
FTP remote.ip.address.4 user=UserName pwd=PassWord get remoteFile Site.4.LocalFile.$Today
The other option is to pass a script file to the FTP program, as per

but this didn't appear to work for me either, the username and password were not accepted.

Any help greatly appreciated!
Old 01-04-2007, 09:22 PM   #2
Registered: Aug 2003
Location: Indiana
Distribution: fc6 sles9 & 10 kubuntu ubuntu-server
Posts: 240
Blog Entries: 2

Rep: Reputation: 30
It's possible. Just to make sure of something is your date format in the form of
Old 01-04-2007, 10:51 PM   #3
Senior Member
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
You could use curl or lftp. Both of which script pretty well.
Old 01-05-2007, 12:57 AM   #4
Senior Member
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 69
It depends what the default FTP client is for your distribution. For instance, OpenBSD's ftp client allows for:
$ ftp -o Site.1.LocalFile.${Today} ftp://user:password@host/remoteFile
To find out whether your FTP client supports it, type
$ man ftp
and read the SYNOPSIS section (at least).

If the default FTP client isn't sufficient, there are some extremely flexible and powerful file retrievers such as curl and wget that can easily do what you describe (and a lot more).


ftp, script

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
FTP command line tommytomato Linux - General 5 01-13-2006 09:57 AM
what is different with Ftp From browser and Ftp from command line zahra79 Linux - Networking 2 06-22-2005 04:26 AM
Command Line FTP erikcw Fedora 3 10-12-2004 10:44 AM
ftp command line acrors Fedora 3 10-02-2004 05:55 AM
command line ftp client keevitaja Linux - Software 2 09-12-2002 05:28 PM

All times are GMT -5. The time now is 07:25 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration