ftp in non-interactive mode

Posted on 2001-07-17
Last Modified: 2012-08-13
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?

Question by:dssuresh
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

ducpham earned 50 total points
ID: 6289333
have you tried the option -s:filename?

Expert Comment

ID: 6296965
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.
LVL 11

Expert Comment

ID: 6828361
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:


Expert Comment

ID: 6846003
Comment from ducphan accepted as answer.
th94nn. look for your question in this topic area.

Thank you
Community Support Moderator

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question