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();
                }
        }
}



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

Reply via email to