AnsweredAssumed Answered

Upload a folder and its content problem!

Question asked by toss on Mar 29, 2011
Hi guys, what I am trying to do is to create a service working on way that, when you input a name of a folder our program upload the folder's content in the same hierarchy as it is on your local hard. I am using Eclipse, Java and I found nice tutorials about Web Service API. I know how I can upload a single file or a folder, but I dont know how to robotize  the whole process  to upload the file's tree. I found a recursive method:

public static void visitAllDirsAndFiles(File dir) {

        // You can do whatever you want with this directory
        // E.g. printing its name to the console
        System.out.println(dir.getName());
   
        if (dir.isDirectory()) {
            String[] children = dir.list();
            for (int i=0; i<children.length; i++) {
                visitAllDirsAndFiles(new File(dir, children[i]));
            }
        }
    }
ok …it prints the folder structure, but how can I combine it with my functions "createSpace"  and "createDocument".

I will appreciate any help!
… or generally is there any other approach?
10x in advance!

Outcomes