You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by eddi <ed...@gmx.net> on 2014/04/01 11:26:51 UTC

Re: Howto delete file from FTP-Endpoint direct

I find a Way for send direct File Opperations to the FTP Endpoint.

from("jetty:http://localhost:7777/action/delete")
            .process(new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                    RemoteFileEndpoint<?> ftpEp = (RemoteFileEndpoint<?>)
getContext().getEndpoint("ftp://user@localhost/share?password=123");
                    RemoteFileOperations<?> operation =
ftpEp.createRemoteFileOperations();
                    operation.connect(ftpEp.getConfiguration());
                    boolean deleted =
operation.deleteFile(ftpEp.getConfiguration().getDirectory()+"/"+"fromJetty.txt");
                    exchange.getOut().setBody("DELETED = "+deleted);
                    operation.disconnect();
                }
            });

Debug and Trace really helps very much.



--
View this message in context: http://camel.465427.n5.nabble.com/Howto-delete-file-from-FTP-Endpoint-direct-tp5749570p5749617.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Howto delete file from FTP-Endpoint direct

Posted by Reji Mathews <co...@gmail.com>.
If you are trying to delete a file after consuming from a ftp server using
ftp camel component, then put the option "delete=true" while configuring
the ftp consumer end point.

Make sure the ftp credentials u are using has rights to perform delete
operations .

Cheers
Reji
On 01/04/2014 3:01 pm, "eddi" <ed...@gmx.net> wrote:

> I find a Way for send direct File Opperations to the FTP Endpoint.
>
> from("jetty:http://localhost:7777/action/delete")
>             .process(new Processor() {
>                 @Override
>                 public void process(Exchange exchange) throws Exception {
>                     RemoteFileEndpoint<?> ftpEp = (RemoteFileEndpoint<?>)
> getContext().getEndpoint("ftp://user@localhost/share?password=123");
>                     RemoteFileOperations<?> operation =
> ftpEp.createRemoteFileOperations();
>                     operation.connect(ftpEp.getConfiguration());
>                     boolean deleted =
>
> operation.deleteFile(ftpEp.getConfiguration().getDirectory()+"/"+"fromJetty.txt");
>                     exchange.getOut().setBody("DELETED = "+deleted);
>                     operation.disconnect();
>                 }
>             });
>
> Debug and Trace really helps very much.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Howto-delete-file-from-FTP-Endpoint-direct-tp5749570p5749617.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>