Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Operating System - Tru64 Unix
Showing results for 
Search instead for 
Did you mean: 

Problem with FTP

Go to solution
José Luis Martínez
Occasional Contributor

Problem with FTP

I have an Alpha Server with Tru64 ver. 4.0 and I want to schedule a script that let me transfer files in mode no interactive. At first a thought in the following command

ftp -s parameter_file_name

But I relialized that this option (-s)not exist in the FTP that is installed with my version of Operating System.

So my question is, Is there a way to transfer a file in mode no interactive.

Thanks in advance!
Mark Grant
Honored Contributor

Re: Problem with FTP

You can try

ftp hostname << EOF
user username
password password

I have never used it but something like that works, I'm sure of it
Never preceed any demonstration with anything more predictive than "watch this"
Joris Denayer
Respected Contributor

Re: Problem with FTP

Here is an example that works already several years.

It is included in a script that is started via cron.

ftp -n -v <user anonymous
cd /the_directory_I_prefer
get the_file_I_need

Of course, I modified some directories and filenames. Modify them for your particular usage.

You can also use expect scripting. This gives you much more possibilities.

Here is a very simple one, without much error recovery, except the timeout.
Beware, it is not a secure solution !!!

#!/usr/local/bin/expect --
if $argc!=1 {
send_user "Usage: ftp-exp \n"

set file "$argv"

set timeout 15
spawn ftp
expect "Name"
send "A_Login_ID\r"
expect "Password:"
send "My_password\r"
expect "ftp> "
send "cd /incoming\r"
expect "ftp> "
send "binary\r"
expect "ftp> "
send "get $file\r"
send "bye\r"
expect "bye."

Hope this inspires.


To err is human, but to really faul things up requires a computer
José Luis Martínez
Occasional Contributor

Re: Problem with FTP

Thanks everybody

Your suggestions were so useful, that rigth now my script is running from the cron, thanks again.