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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is Solaris 2.6 FTP Script-able?

Status
Not open for further replies.

stevenriz

IS-IT--Management
May 21, 2001
1,069
Looking to automate a put and a get on a remote FTP server from one of our Sun servers running Solaris 2.6. I cannot find a switch or parameter that will use a file containing the commands for login name, password, put, get, rm, etc...

Is it possible or are there any other third party FTP clients out there (free) that will do what I need?

Thanks.
Steve
 
You can use a file to input to ftp , ex:

ftp host_name < input_file

host_name is the name of the host you want to ftp to
Input_file is a file with a list of commands for ftp, ex:

USER myself mypasswd
put file_name
quit
 
I dont known wether the thing with the inputfile
USER mysel mypasswd
works, but what works is :
- create a file .netrc in the homedirectory of the user who wants to do the ftp
- chmod 600 .netrc ( otherwise it doesnt work )
- insert in .netrc a line like :
machine myhost login myuser password mypassword

Thats it. Now a command like
# ftp myhost
will login you to myhost as myuser with password mypassword

( see also man netrc )

Andi

 
Hello

Hope this helps you.

create a file containing the file names u want to ftp (one file name per line. Assume file_name)

Put following script in one file.

for i in `cat file_name`
do
ftp -v -n << EOF
open remote_system_name_or_ip_address
user &quot;username&quot; password
bell
prompt
cd remote_directory
put $i (or get)
bye
EOF
done


Give execute permission to this script.

Thanks

Sharad

PS: If u want to use mget or mput use -i option with ftp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top