File (Class)

File class

Warning:

Access via file APIs is limited to the var, sftp and temporary folders of ÃÛ¶¹ÊÓƵ Campaign.

Here is an example of how to use the class to read and process all the lines of a file in sequence.


var file = new File("/tmp/test.txt")
file.open()
for each(var line in file)
  logInfo(line)
file.close()
 

Methods

File

Creates a new object associated with a file.

close

Closes the file.

copyTo

Copies a file.

dispose

Frees the resources used by the object.

flush

Forces writing on the disk

list

Lists the content of a directory.

mkdir

Creates a directory with the path of the current

File

object.

open

Opens the file in read or write mode.

remove

Deletes the file.

renameTo

Renames a file.

readln

Reads a line of the text file.

rmdir

Deletes the directory (not in cascade).

writeln

Writes a line of text to the file.

Properties

canRead

Returns true if the file can be read.

canWrite

Returns true if the file can be modified.

exists

Returns true if there is a file or folder with this name.

fullName

Returns the name of the file in absolute.

isDirectory

Returns true if the file is a directory.

isFile

Returns true if the file exists and is a file.

isOpen

Returns true if the file is open.

lastModified

Returns the last modification date in the form of a Date object.

name

Returns the name of the file with the extension, but without the path.

path

Returns the complete path of the file ended by the separator.

size

Returns the size of the file in bytes.

Features

Available in:

  • Content management
  • Delivery properties
  • Typology rule
  • JSSP
  • SOAP Method
  • WebApp
  • Workflow