On 02/06/2009, Kevin Dougan <kevindou...@hotmail.com> wrote:
>
>  Hi and thanks for your reply. I'll try and give an example to illustrate...
>
>
>
>  Let's say there's a file that contains the following lines:
>
>    CWD /home/sampleuser/
>
>    PUT localfile.txt remotefile.txt
>
>
>  I am building a Java Class that will be "dumb", in the sense that it will 
> just open the file (after connecting to the FTP Server using some other 
> properties), and issue the commands it finds in that file. The idea is that 
> the caller can dynamically build a file of commands, and the program does not 
> have to parse them individually and decide what they are, the program can 
> simply pass them along to the FTP Server.
>
>
>
>  Therefore, I was thinking that I could use the FTPClient.sendCommand() 
> method to simple forward those commands, but it is not working.
>

Which sendCommand() method are you using?

There are several, with different parameters.

>
>  I do NOT want to do the following:
>
>  ...read line from file: PUT localfile.txt remotefile.txt
>
>  ...decide which API method to call: if (line.startsWith("PUT")) 
> client.storeFile(remoteFile, localFile); else if 
> (line.statrsWith("GET"))...etc, etc
>
>
>
>  However, I am trying to do something more simple, like the following:
>
>  ...read line from file: PUT localfile.txt remotefile.txt
>
>  ...pass the command along
>
>  ...read next line from file: : : :
>
>  ...pass the command along: : : :
>
>  ...etc, etc
>
>
>
>
>  Thanks!
>  Kevin
>  kevindou...@hotmail.com
>
>
>
> > From: sc...@camsbycbs.com
>
> > To: user@commons.apache.org
>
> > Subject: Re: Question about FTPClient.sendCommand()
>  > Date: Tue, 2 Jun 2009 08:29:55 -0400
>
> >
>  > I'm not sure if I understand what you're trying to accomplish. Are you
>  > sending FTP commands to the FTP server? If so, what command? Or are you
>  > trying to send operating system shell script commands? The FTP server is
>  > only going to accept commands it understands and supports, which is not the
>  > same as OS shell scripts.
>  >
>  > ----- Original Message -----
>  > From: "Kevin Dougan" <kevindou...@hotmail.com>
>  > To: <user@commons.apache.org>
>  > Sent: Tuesday, June 02, 2009 7:14 AM
>  > Subject: Question about FTPClient.sendCommand()
>  >
>  >
>  >
>  > Greetings!
>  >
>  > I have been searching around a lot, trying to figure out how to properly 
> use
>  > the FTPClient.sendCommand() API method, but to no avail! Perhaps someone
>  > here can answer my question very quickly...?
>  >
>  > Basically, I want to implement a "dumb" FTP class who handles "batch
>  > processing". I thought I could just read lines from a file, and then pass
>  > them through to an FTP Server using the sendCommand() method, but it always
>  > replies with "command not understood".
>  >
>  > Am I totally off track with what I want to do here? Am I using the API
>  > method incorrectly or for the wrong purpose?
>  >
>  > I am trying to avoid parsing every command, doing a String compare on each
>  > word, and then trying to match it against a specific API method
>  > (storeFile(), retrieveFile(), etc.), depending on each String I 
> parse...big,
>  > long IF blocks are ugly!
>  >
>  > Thanks!
>  > Kevin
>  > kevindou...@hotmail.com
>  >
>  >
>  > _________________________________________________________________
>  > Attention all humans. We are your photos. Free us.
>  > http://go.microsoft.com/?linkid=9666046
>  >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>  > For additional commands, e-mail: user-h...@commons.apache.org
>  >
>
>
> _________________________________________________________________
>  We are your photos. Share us now with Windows Live Photos.
>  http://go.microsoft.com/?linkid=9666047

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to