Link to home
Start Free TrialLog in
Avatar of dssuresh
dssuresh

asked on

ftp in non-interactive mode

I want to ftp a file in a non-interactive way from a Nt machine [ftp server is installed in NT machine]

ie. something like this.. in a single line

The foll. will be invoked in a unix system

$ ftp <ip addr> user <username> password <passwd> get filename

There is a tool "expect" using which we can put our commands in a file and "expect" will take care of the rest. Other than this, ie. without using expect , is there a way to do this, using shell commands alone?

ASKER CERTIFIED SOLUTION
Avatar of ducpham
ducpham

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of th94nn
th94nn

your standard PC ftp will read from a file:
ftp -s:filename
(check with ftp -h)
so if you want to do it as you indicate, then you can
make a batch file or script that you call myftp

in the script you will be grabing $1 $2 $3 etc..
build your tempfile so:
echo "USER fred" >tempfile
echo "password xyz" >>tempfile
..
..
echo get $3 >>tempfile
ftp -s tempfile
delete tempfile

the correct syntax you have to do yourself..
but this is the Idea.

your Unix ftp example doesn't work from a csh...
I also use a script to autoftp under Unix.
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to accept "ducpham, th94nn" comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is: https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
Comment from ducphan accepted as answer.
th94nn. look for your question in this topic area.

Thank you
Computer101
Community Support Moderator