marlon

Gel script calling Java method

Discussion created by marlon on Oct 12, 2010
Latest reply on Oct 12, 2010 by Paul_Maxwell
I have a couple of example (Javascript & Gel script) files I want to implement, so seeking advice on:   (1)   where to put the Javascript;    (2) whether this Javascript will even work to achieve what I want; and (3) will the Gel script actually invoke it properly?     The desired outcome is that an existing Source folder on our network drive will be copied to a new folder.    I've seen a post or two here with an example of calling a Date utility, but that only has one argument, and it also didn't specify where the Javascript file actually needs to be stored on the server for the Gel Script to recognize it when it's invoked.  Any help/info appreciated. File: z_copy_dir.js import java.io.*;   public class CopyDirectory{
 
  public void copyDirectory(File srcPath, File dstPath)
                                                            throws IOException{
 
  if (srcPath.isDirectory()){           if (!dstPath.exists()){               dstPath.mkdir();
 
        }        String files[] = srcPath.list();
 
      for(int i = 0; i 0) {
 
                  out.write(buf, 0, len);               }
 
            in.close();
 
                    out.close();           }
 
    }
   
 System.out.println("Directory copied.");
 
 }}   Gel Script:   
              
        
 
  Project Folders created successfully 

Outcomes