Forum Discussion

JesperJ's avatar
JesperJ
New Contributor
5 years ago

soap groovy copt file - inChannel.transferTo & Files.copy(

I'm loosing my mind over this, every time I find some examples online that should work they either throw loads of messages or it just does not work. SOap 3.0 pro on Windows 10.   I need to make a c...
  • NBorovykh's avatar
    5 years ago

    Hi JesperJ,

     

    The below code works for me. Please copy the full snippet to your Groovy Script test step, correct the file paths and try it out.

    import java.nio.file.Path;
    import java.nio.file.Paths;
    import java.nio.file.Files;
    
    Path source = Paths.get("C:\\Temp\\source.xlsx")
    Path destination = Paths.get("C:\\Temp\\destination.xlsx")
    Files.copy(source, destination);

    You can enhance it as it's described here to handle the situation when the destination file already exists in the location.