[TAG] How do you format ftp or sftp for transfering files?...
lew.pitcher at digitalfreehold.ca
Mon Mar 9 18:10:02 MSK 2009
On March 9, 2009 10:51:28 Ben Okopnik wrote:
> On Mon, Mar 09, 2009 at 10:23:14AM -0400, Lew Pitcher wrote:
> > 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.
> In the part that you snipped, there were responses from 'sftp' that
> showed where the commands succeeded. You could capture and/or test for
> those if you wanted to. Plain FTP can be made verbose as well:
> -v Verbose option forces ftp to show all responses from the remote
> server, as well as report on data transfer statistics.
I hadn't thought about using post-analysis, but it sounds like it would work
in most cases. I was thinking more of the inability to respond immediately to
error conditions; if (in your example), the /tmp directory didn't exist,
the "cd /tmp" would have failed, and your client session would potentially be
left in the initial server-side directory. In this case, do you /really/ want
the client to execute the "put FOOBAR"? FOOBAR might wind up in the wrong
directory, necessitating some amount of clean-up that is cumbersome to
> It seems like all of that is definitive and testable - although I'd
> agree that it's not as easy as it should be.
True. And if you are confident enough in the stability of your preloaded
commands (and/or your post-analysis recovery), there's no reason /not/ to use
this sort of setup. As I said, I've done exactly that in a number of
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
Size: 218 bytes
Desc: This is a digitally signed message part.
Url : http://lists.linuxgazette.net/mailman/private/tag/attachments/20090309/3b518ffb/attachment.pgp
More information about the TAG