Version

    CreateFiles

    Jobflow Component

    Short Description
    Ports
    Metadata
    CreateFiles Attributes
    Details
    Examples
    See also

    Short Description

    CreateFiles can create files and directories. It is also capable of setting a modification date of both existing and newly created files and directories. Optionally, non-existing parent directories may also be created.

    [Note]Note

    To be able to use this component, you need a separate jobflow license.

    ComponentInputsOutputsAuto-propagated metadata
    CreateFiles0-10-2

    Ports

    Port typeNumberRequiredDescriptionMetadata
    Input0Input data records to be mapped to component attributes.Any
    Output0ResultsAny
    1ErrorsAny

    Metadata

    CreateFiles does not propagate metadata from left to right or from right to left.

    This component has metadata template available. The templates of CreateFiles are described in Details. See details on metadata templates.

    CreateFiles Attributes

    AttributeReqDescriptionPossible values
    Basic
    File URLyes[1]

    Path to the file or directory to be created (see Supported URL Formats for File Operations). If it ends with a slash ('/'), it denotes that a directory should be created, which can also be specified using the Create as directory attribute.

     
    Create as directorynoSpecifies that directories should be created instead of regular files.false (default) | true
    Create parent directoriesnoAttempt to create non-existing parent directories.false (default) | true
    Last modified dateno

    Set the last modified date of existing and newly created files to the specified value. Format of the date is defined in the DEFAULT_DATETIME_FORMAT property (Chapter 17, Engine Configuration).

     
    Input mapping[2]Defines mapping of input records to the component attributes. 
    Output mapping[2]Defines mapping of results to the standard output port. 
    Error mapping[2]Defines mapping of errors to the error output port. 
    Redirect error outputnoIf enabled, errors will be sent to the standard output port instead of the error port.false (default) | true
    Verbose outputno

    If enabled, one input record may cause multiple records to be sent to the output (e.g. as a result of wildcard expansion). Otherwise, each input record will yield just one cumulative output record.

    false (default) | true
    Advanced
    Stop processing on failno

    By default, a failure causes the component to skip all subsequent input records and send the information about skipped input records to the error output port. This behavior can be turned off by this attribute. Note: this function works only if an edge is connected to the component's error port.

    true (default) | false

    [1]  The attribute is required, unless specified in the Input mapping.

    [2]  Required if the corresponding edge is connected.

    Details

    Editing any of the Input, Output or Error mapping opens the Transform Editor.

    Input mapping

    The editor allows you to override selected attributes of the component with the values of the input fields.

    Field NameAttributeTypePossible values
    fileURLFile URLstring 
    directoryCreate as directorybooleantrue | false
    makeParentDirsCreate parent directoriesbooleantrue | false
    modifiedDateLast modified datedate 
    Output mapping

    The editor allows you to map the results and the input data to the output port.

    If Output mapping is empty, fields of the input record and result record are mapped to the output by name.

    Field NameTypeDescription
    fileURLstringURL of the target file or directory.
    resultboolean

    True if the operation has succeeded (can be false when Redirect error output is enabled).

    errorMessagestring

    If the operation has failed, the field contains the error message (used when Redirect error output is enabled).

    stackTracestring

    If the operation has failed, the field contains the stack trace of the error (used when Redirect error output is enabled).

    Error mapping

    The editor allows you to map the errors and the input data to the error port.

    If Error mapping is empty, fields of the input record and result record are mapped to the output by name.

    Field NameTypeDescription
    resultbooleanWill always be set to false.
    errorMessagestringThe error message.
    stackTracestringThe stack trace of the error.
    fileURLstringURL of the target file or directory.

    Examples

    Touching the File with CreateFiles

    Create file touch_me.txt. If the file exists, update the last modification time.

    Solution

    Use attributes .

    AttributeValue
    File URL${DATATMP_DIR}/touch_me.txt
    Input mappingSee the code below
    function integer transform() {
        $out.0.modifiedDate = today();
    
        return ALL;
    }

    You can optionally set Create parent directories to true.