[TAG] How do you format ftp or sftp for transfering files?...

Lew Pitcher lew.pitcher at digitalfreehold.ca
Mon Mar 9 17:23:14 MSK 2009


On March 8, 2009 18:28:31 Ben Okopnik wrote:
> On Sun, Mar 08, 2009 at 04:52:23PM -0400, Lew Pitcher wrote:
> > Note also that normally, both ftp and sftp are interactive; the command
> > invocation does not usually define all the file transfer requirements.
>
> Actually, that part's pretty easy.
>
> ```
> ben at Tyr:~$ >FOOBAR
> ben at Tyr:~$ echo -e "cd /tmp\nput FOOBAR\n"|sftp ben at localhost
[snip]

True(ish)

I've used something similar in a couple of my own projects.

The drawback for "preloading" the responses to an interactive stream like this 
is that neither ftp nor sftp include a way to determine whether or not the 
commands worked. Had your sftp session not been able to connect to localhost, 
or not been able to cd to /tmp, the "preloaded" command stream would have 
failed, but /appeared/ to have worked.

There /are/ (s)ftp clients that support scripting, and scripting languages 
(like perl and php, for instance) that support (s)ftp, so this potential flaw 
can be remedied.

OTOH, the OP has yet to explain what he meant, so perhaps we are going down 
the wrong path. I guess time will tell.  :-)


-- 
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/   | GPG public key available by request
----------      Slackware - Because I know what I'm doing.          ------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 218 bytes
Desc: This is a digitally signed message part.
Url : http://lists.linuxgazette.net/mailman/private/tag/attachments/20090309/07610b8b/attachment.pgp 



More information about the TAG mailing list