Copying files and directories in test setup

PBelandPBeland Posts: 14

I'm a complete dummy in Java. I have service for which I need to setup a file directory structure in the test setup.

I thought of using Groovy scripts to copy the files rather than creating batch files. It seems to be an easy task with Apache FileUtils but I can’t figure out how to use it in my Extension script.

I tried to add the jar to the ClassPath and adding an import


but I get the error message:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:, Script13.groovy: 3: unable to resolve class, @ line 3, column 1., import;, ^, , 1 error,

Anyone can help or can suggest another way of doing?




  • PBelandPBeland Posts: 14

    I really am a dummy! Only thing I was missing is the star in the import. No need to add ant Classpath...

    Here's a working example:

    import com.parasoft.api.*;
    boolean copyFilesToWorkingDir(Object input, ExtensionToolContext context) {
        File source = new File("c:\\temp\\a\\a.txt");
        File dest = new File("c:\\temp\\b");
        FileUtils.copyFileToDirectory(source, dest, true);
        return true;    
Sign In or Register to comment.