First question: Do you want to use plain Java (as the code you showed) or 
Apache Camel?
For plain java you'll have to use an FTP library to do that. Have a look at 
Apache common-net: http://commons.apache.org/proper/commons-net/
You cannot simply refer to an FTP location in the File("") constructor. You 
have to download the file using the library.
If you need help with that, you can always ask on their mailing list (this is 
not the place for it).

If you want to use Camel, then first have a look at the pointers Claus gave you.
There is a lot of information on the Camel website to get you started. Try one 
of the examples first.
And then you can start working with the Camel FTP component.

________________________________
Van: milan777 [via Camel] [ml-node+s465427n5733097...@n5.nabble.com]
Verzonden: vrijdag 24 mei 2013 15:34
To: Wuyts Diether
Onderwerp: Re: Camel-configuration

I am not getting file from the ftp this is my problem and i can show u my code 
also....


import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class FileCopier {
        public static void main(String args[]) throws Exception {
                File inboxDirectory = new File("ftp://127.1.1.1/";);
                File outboxDirectory = new 
File("C:/Users/Lenovo-2/Desktop/milan/my_workspace/Test class/src/data/outbox");
                /*
                 * Listing 1.1 Routing files from one folder to another in 
plain Java
                 * data/inbox File data/outbox Figure 1.2 Files are routed from 
the
                 * data/inbox directory to the data/outbox directory. www 
.it-ebo
                 * oks.info 10 CHAPTER 1 Meeting Camel
                 */
                outboxDirectory.mkdir();
                File[] files = inboxDirectory.listFiles();
                System.out.println(files);
                try{for (File source : files) {
                        if (source.isFile()) {
                                File dest = new File(outboxDirectory.getPath() 
+ File.separator
                                                + source.getName());
                                copyFile(source, dest);
                        }
                }}

                catch(Exception  e){}
        }

        private static void copyFile(File source, File dest) throws IOException 
{
                System.out.println("hi");
                OutputStream out = new FileOutputStream(dest);
                byte[] buffer = new byte[(int) source.length()];
                FileInputStream in = new FileInputStream(source);
                in.read(buffer);
                try {
                        out.write(buffer);
                } finally {
                        out.close();
                        in.close();
                }
        }
}

________________________________
If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/Camel-configuration-tp5732936p5733097.html
To start a new topic under Camel - Users, email 
ml-node+s465427n465428...@n5.nabble.com
To unsubscribe from Camel - Users, click 
here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=ZGlldGhlci53dXl0c0BvcHRpcy5iZXw0NjU0Mjh8OTE4NjI3OTg5>.
NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-configuration-tp5732936p5733100.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to