Subject: Re: Automated FTP uploading via Script

From: [email-masked]
Date: Wed, 05 Aug 98 20:52:28 +0330

Hi,
You can use "expect" at: http://expect.nist.gov which automate any interactive 
commands like telnet and ftp.

--Nader

   //\\                 Nader  Atoofi
  //  \\           Unix and Network Administrator
 //    \\          DP IRAN Co. Tehran Iran
 \\    //          E-Mail:[email-masked]
  \\  //           E-Mail:[email-masked]
   \\//            Web:http://atoofi.com
  DP IRAN          Web:http://dpi.net.ir/~nader

> From [email-masked] Wed Aug  5 20:45:24 1998
> Date: Wed, 05 Aug 1998 17:02:49 +0100
> From: Yilmaz Oztanir <[email-masked]>
> To: "[email-masked]" <[email-masked]>
> Subject: Automated FTP uploading via Script
> Mime-Version: 1.0
> X-Sender: [email-masked]
> X-Listprocessor-Version: 8.0 -- ListProcessor(tm) by CREN
> 
> <HTML>
> Hi everybody
> 
> <P>I was wondering if anybody has any experience with automated FTP uploading
> via scripts. Basically, what I want to do is run a script e.g.
> 
> <P><TT>putfile &lt;file></TT><TT></TT>
> 
> <P>The basic script:<TT></TT>
> 
> <P><TT>ftp MACHINENAME</TT>
> <BR><TT>cd /pub</TT>
> <BR><TT>bin</TT>
> <BR><TT>put $1</TT>
> <BR><TT>quit</TT>
> 
> <P>This should log in to a predefined FTP site (using the autologin feature
> and .netrc) and then use 'put' commands to do uploads. At present, I have
> the logging in bit working, but the FTP&nbsp;prompt doesn't see the rest
> of the commands. These are run after FTP is quit manually:
> 
> <P><TT>ftp> exit</TT>
> <BR><TT>221 Goodbye.</TT>
> <BR><TT>./putfile: /pub: No such file or directory</TT>
> <BR><TT>./putfile: bin: command not found</TT>
> <BR><TT>./putfile: put: command not found</TT>
> <BR><TT>./putfile: quit: command not found</TT>
> 
> <P>Therefore, my question is whether FTP&nbsp;can run the commands provided
> in the shell script.
> 
> <P>Any help would be greatly appreciated.
> <BR>&nbsp;
> 
> <P>Yilmaz</HTML>
> 
> --------------7D51D4BB85FA44D219850611--
> 
>

---

From: [email-masked] (Valentin)
Date: Wed, 5 Aug 1998 16:44:02 -0500

>The basic script:

>ftp MACHINENAME
>cd /pub
>bin
>put $1
>quit

>This should log in to a predefined FTP site (using the autologin feature and
>.netrc) and then use 'put' commands to do uploads. At present, I have the
>logging in bit working, but the FTP prompt doesn't see the rest of the
>commands.

Try using a macro definition in your .netrc file. Example:

machine "machine name"
login "login name"
passwd "passwd"
macdef init
binary
cd /pub
put "filename"
quit
<blank line>

Don't forget the blank line to terminate your macro definition.