Skip to main content
File operations enable you to perform standard file input/output. You can use these operations to move files across directories, log job results, and much more. The example below uses the fileWrite operation in the post-job event to write a new line to a log file:
<api:info title="After Run" desc="This event is fired after running a job.">
  <input name="JobName"         required="true" desc="The name of the job being executed." />
  <input name="Source"          required="true" desc="The name of source connection." />
  <input name="Destination"     required="true" desc="The name of destination connection." />
  <input name="JobStatus"       required="true" desc="The status of the completed run."/>
  <input name="Query#"          required="true" desc="An array containing each query that was executed." />
  <input name="QueryStatus#"    required="true" desc="An array containing the status of each query that was executed." />
</api:info>

<api:set attr="file.file"  value="C://mylog.log"/> 
<api:set attr="file.data"  value="[null | now()]: The Job [_input.jobname] completed with a status of [_input.jobstatus]"/>
<api:set attr="file.mode"  value="truncate"/>

<api:call op="fileWrite" in="file"/>

Operations

fileCopy

Copies a file or a directory to the path that is specified.
Required Input AttributeDescription
sourceThe name of the file that is to be copied.
destinationThe name of the file after it is copied.
Optional Input AttributeDescription
forceIf force is set to true, the operation creates missing directories. The allowed values are true and false. The default value is true.
maskThe pattern that is used to select the entries that are to be copied. The default value is *.
recurseRecursively copy files and directories. In this case, the destination is assumed to be a directory. The allowed values are false and true. The default value is false.
Output AttributeDescription
file:sourceThe full path of the source file.
file:destinationThe full path of the destination file.

fileCreate

Creates a text file and, optionally, writes to it.
Required Input AttributeDescription
fileThe name of the file that is to be created.
Optional Input AttributeDescription
forceIf force is set to true, the operation creates missing directories. The allowed values are true and false. The default value is true.
dataThe data that is to be written in the file.
modeThe mode of writing. The allowed values are truncate and append. The default value is truncate.
encodingThe encoding of the file. The default value is UTF-8.
Output AttributeDescription
file:fileThe full path of the file that is created.
file:cdateThe creation date of the file.

fileDelete

Deletes a file or a directory.
Required Input AttributeDescription
fileThe name of the file or directory that is to be deleted.
Output AttributeDescription
file:fileThe name of the file or directory that is deleted.

fileListDir

Lists the files and the directories in the specified path.
Required Input AttributeDescription
pathThe path whose directories and files will be listed. The default value is ..
Optional Input AttributeDescription
maskThe pattern that is used for filtering the result entries. The default value is *.
recurseTo list entries recursively. The allowed values are false and true. The default value is false.
fileordirTo list only files or directories. The allowed values are all, files, and dirs. The default value is all.
Output AttributeDescription
file:fullnameThe full path of the file or directory in the current entry.
file:nameThe name of the file or directory in the current entry.
file:mtimeThe time at which the file or directory in the current entry is written to.
file:ctimeThe time at which the file or directory in the current entry is created.
file:atimeThe time at which the file or directory in the current entry is last read from or written to.
file:attributesA list of attributes of the file or directory in the current entry.
file:extensionThe extension of the entry.
file:sizeThe size of the file in bytes.
file:isdirWhether the entry is a file or a directory.

fileMakeDir

Creates the directory that is specified by the path.
Required Input AttributeDescription
pathThe path of the directory that is to be created.
Optional Input AttributeDescription
forceIf force is set to true, the operation creates missing directories. The allowed values are true and false. The default value is true.
Output AttributeDescription
file:pathThe directory that is created.
file:cdateThe creation date of the directory.

fileMove

Moves a file or a directory to the path specified.
Required Input AttributeDescription
sourceThe source path that is to be moved.
destinationThe destination that is to be moved to.
Optional Input AttributeDescription
forceIf force is set to true, the operation creates missing directories. The allowed values are true and false. The default value is true.
Output AttributeDescription
file:sourceThe full path of the source file.
file:destinationThe full path of the destination file.

fileRead

Reads a text file and pushes out the data.
Required Input AttributeDescription
fileThe name of the file that is to be read.
Optional Input AttributeDescription
encodingThe encoding of the file. The default value is UTF-8.
Output AttributeDescription
file:dataThe file data.

fileReadLine

Reads a text file and pushes out the next line.
Required Input AttributeDescription
fileThe name of the file to read.
Optional Input AttributeDescription
separatorThe separator of the file. The default value is the newline character.
encodingThe encoding of the file. The default value is UTF-8.
Output AttributeDescription
file:lineThe line number of the file.
file:dataThe file data.

fileWrite

Writes encoded data to a file.
Required Input AttributeDescription
fileThe name of the file that is to be read.
dataThe data that is to be written in the file.
Optional Input AttributeDescription
forceIf force is set to true, the operation creates missing directories. The allowed values are true and false. The default value is true.
modeThe mode of writing. The allowed values are truncate and append. The default value is truncate.
encodingThe encoding of the file. The default value is UTF-8.
Output AttributeDescription
file:fileThe full path of the file that is written to.
file:cdateThe modified date of the file.