Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I think the forum is a great idea, especially for those of us in consulting engineering. Keep up the good work!..."

Geography

Where in the world do Tek-Tips members come from?
banana (IS/IT--Management)
27 Nov 00 12:32
HI All, I would like to automate an ftp session, giving it the contents of a file to execute instead of typing the commands myself... this is to automate the download of files from a server to an other from the web... is this a simple way to do this from a shellscript point of view? I'm on Solaris 2.5.1 at present... thanks in advance.
grega (Programmer)
27 Nov 00 14:19
banana,

The ftp command itself can accept a file of commands.  Do a man ftp to get full details, but simply put, a file name can be specified by the -s switch.  You also need to think how you intend to logon to the remote machine (unless you're using anonymous ftp).

So if you have a file ftpfile, the command would simply be ftp -s:ftpfile.

The contents of ftpfile might look like;

open servername
put file1
bin
put file2
quit


If you need any more info about logging on etc., I'd be happy to explain. It's worth double checking what I've mentioned above anyway as I'm doing it from memory.

Greg.
dbachpb (MIS)
28 Nov 00 13:45
You can alos try this method :
ftp -i -n -v destination_name < /exploit/input_file
and your input file would loook like this :
user username password
put filename
quit


The flags specified work for Sun Solaris, cant garantee other os

Hope this helps
grega (Programmer)
28 Nov 00 16:32
... which also reminds me ... It can be done without an input file at all, in that you can put an ftp wrapper around the ftp commands themselves and treat the file as a standalone shell script. So you may have a shell script which contains something like ..

ftp <<!
open servername
user username password
put file1
put file2
quit
!

Obviously this isn't a suitable solution if you have a dynamic list of files to transfer.

Greg.
teddy74 (IS/IT--Management)
5 Dec 00 13:16
Hi !

You can also try creating a .netrc file in the users homedirectory ,a template of .netrc is as follows

machine <hostname> login <loginid> password <passwd>
macdef init
bin
put filename1 filename2
...
bye
endmac
<blank line>


After creating the .netrc in the users homedirectory ,
just say
$ ftp <hostname>

The ftp happens automatically ,
I have tried this on AIX , i am not sure on solaris!!

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close