LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 01-04-2007, 08:05 PM   #1
Critcho
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?

e.g.
Code:
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
http://www.reallylinux.com/docs/autoftp.shtml

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

Any help greatly appreciated!
Thanks,
Scotty.
 
Old 01-04-2007, 08:22 PM   #2
xjlittle
Member
 
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
Code:
070104
?
 
Old 01-04-2007, 09:51 PM   #3
stickman
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-04-2007, 11:57 PM   #4
chort
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:
Code:
$ ftp -o Site.1.LocalFile.${Today} ftp://user:password@host/remoteFile
To find out whether your FTP client supports it, type
Code:
$ 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).
 
  


Reply

Tags
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 08:57 AM
what is different with Ftp From browser and Ftp from command line zahra79 Linux - Networking 2 06-22-2005 03:26 AM
Command Line FTP erikcw Fedora 3 10-12-2004 09:44 AM
ftp command line acrors Fedora 3 10-02-2004 04:55 AM
command line ftp client keevitaja Linux - Software 2 09-12-2002 04:28 PM


All times are GMT -5. The time now is 06:55 PM.

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