Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ftp on multiple files

Status
Not open for further replies.

Ramu66

Programmer
Jun 2, 2004
7
US
I need to read a set of filenames from another file
and ftp them to a remote system. What is the way to send
it by using ftp command once and send them all in a loop
instead of using ftp command in the loop

thanks
 
something like should get you going:

Code:
#!/bin/ksh

file='fileList.txt'

ftp -n myHost <<!
user myUser myPasswd
cd myDestinationDirectory
$(sed -e 's/^/put /g' ${file})
!

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Simply build a ftp script in the loop.
Then you can use this script as standard input for a single ftp session.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
could you elaborate please. Do you mean to say we can give
a script as an argument to ftp command

 
I guess you have to understand the basics of unix scripting, like standard I/O redirection.
In this instance, something like:
ftp YourOptionsList < /path/to/ftpscript
That said, some ftp flavors admits a -s option.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top