- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to loop an FTP?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2002 01:34 AM
10-25-2002 01:34 AM
I want to sent large ascii files from one server to another using ftp. It would be nice if I could write a loop that would take care of this within the ftp command. I started to put together a scipt you will find in the attachment.
it's not finnished and I don't like it anyway, because it can put in only one file at a time. How can I write the script, so that it will loop, thereby taking care of all the files in the directory safely. I would also like to be able to send, let's say, 10 files at a time. A collegue of mine suggested I just use a wild card in the ftp-command, but that didn't help.
Can someone help me out here?
Regards,
Ron
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2002 01:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2002 01:43 AM
10-25-2002 01:43 AM
Re: How to loop an FTP?
The script was .doc file so couldnt open it. here is a script. i have a similar one to which i pass the server, username, passwd, files etc and it ftp's the files for me.
++++++cut here +++++++++++++++
USER=" "
PASSWD=" "
SERVER = " "
FILES = ".. .. .. .. .."
ftp -in $ << EOF
user $USER $PASSWD
mput $FILES
bye
EOF
+++++end of script ++++++++++
not tested it but should work.
hth
-balaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2002 01:44 AM
10-25-2002 01:44 AM
Re: How to loop an FTP?
Use the mput command or
put
put
See man ftp
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2002 01:45 AM
10-25-2002 01:45 AM
Re: How to loop an FTP?
1. ftp each file individually within a shell loop, something like...
for file in...
do
done
2. Build a file which is used to drive ftp, something like...
cat > $TMPF << EOD
EOD
for file in...
do
cat >> $TMPF << EOD
put $file
EOD
done
ftp -n
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2002 02:06 AM
10-25-2002 02:06 AM
Re: How to loop an FTP?
i would use the mput option instead.
E.g.
==============================
#!/bin/sh
# YD-25/10/2002
# test1.sh
ftp gig-slx2 <
prompt
mput ydfiles*
bye
EOF
==============================
easy ;)
Cheers
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2002 02:09 AM
10-25-2002 02:09 AM
Re: How to loop an FTP?
For example (just typed out now - not tested!)
ftp -nv foo |&
print -p "user alice"
print -p "pass bob"
do
read -p line
until ${line% *} = @(2??)
for i in ${filelist}
do
print -p "put ${i}"
done
This gives you the advantage that you can test to see whether the put actually worked and retry or report an error (but you will need to parse the return codes)
The other way is to use expect, or netcat to achieve a similar goal as above.
HTH
dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2002 02:16 AM
10-25-2002 02:16 AM
Re: How to loop an FTP?
I tested your script suggestion. It worked! I just had to change the source and destination, but that was my thing. Thanks a lot.
How does the 'echo' work? It contradicts the assumtion, which several other suggestions imply, that one can't loop within ftp!
Again thanks.
Regarding all other suggestions: I will take a look at them and credit them as they apply.
Thanks to everyone for the responses!
Ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2002 04:19 AM
10-25-2002 04:19 AM
Re: How to loop an FTP?
I thought a bit more about hoe the echo works.
It seend the comman out to the shell that called the script. That's why I can see the commands being executed.
Thanks,
Ron