Temporary Dirs

def dir = fs.tempDir("my-dir-prefix") def path = dir.resolve("my-file") fs.writeText(path, "hello world") def parentDir = fs.tempDir("my-dir-prefix") def dir = fs.tempDir(parentDir, "nested-temp-dir")

Temporary Files

def file = fs.tempFile("my-file-prefix", ".txt") fs.writeText(file, "hello world") def dir = fs.tempDir("temp-dir-prefix") def file = fs.tempFile(dir, "my-file-prefix", ".txt") /tmp/temp-dir-prefix5335268953361909206/my-file-prefix18238288925415767834.txt

Automatic Deletion

Note: temp files and temp directories will be automatically deleted at the end of run