Copy Files

Applies to ReadyAPI 3.53, last modified on May 15, 2024

You can use Groovy scripts to copy files in your file system.

Where to use

You can use this script anywhere in ReadyAPI.



//Import libraries for working with files
import java.nio.file.Path
import java.nio.file.Paths
import java.nio.file.Files

//Create objects for the copied file and the target file
Path source = Paths.get("C:\\Users\\elle.stevenson\\Desktop\\test.xlsx")
Path target = Paths.get("C:\\Users\\elle.stevenson\\Desktop\\out\\copied.xlsx")

//Copy the file
Files.copy(source, target)

See Also

Groovy Scripting Samples

Highlight search results