1.8

Table Of Contents
copyFile(source, target)
source
String that specifies the source file path and name.
target
String that specifies the target file path and name.
Example
This script copies the file test.txt from c:\Content into the c:\out folder.
copyFile("c:\Content\test.txt","c:\out\")
createTmpFile()
Function that creates a file with a unique name in the temporary work folder and returns a file
object. This file stores data temporarily in memory or in a buffer. It is used to prevent multiple
input/output access to a physical file when writing. In the end, the contents are transferred to a
physical file for which only a single input/output access will occur.
Example
In the following script, the contents of the data sample file are copied in uppercase to a
temporary file.
try{
// Open a reader
var reader = openTextReader(data.filename);
// Create a temporary file
var tmpFile = createTmpFile();
// Open a writer on the temporary file
var writer = openTextWriter(tmpFile.getPath());
try{
var line = null; // Current line
/* read line by line and readLine will return null at the end of
the file */
while( (line = reader.readLine()) != null ){
// Edit the line
line = line.toUpperCase();
// Write the result in the temporary file
writer.write(line);
// add a new line
Page 293