Copy Files

Applies to ReadyAPI 3.55, last modified on October 09, 2024

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

Where to use

You can use this script anywhere in ReadyAPI.

Example

Groovy

//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
Scripting

Highlight search results