ListFiles

Jobflow Component

Short Description
Ports
Metadata
ListFiles Attributes
Details
Examples
Compatibility
See also

Short Description

ListFiles lists directory contents including detailed information about individual files, e.g. size or modification date. Subdirectories may be listed recursively.

[Note]Note

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

Component Inputs Outputs Auto-propagated metadata
ListFiles0-11-2
yes

Ports

Port typeNumberRequiredDescriptionMetadata
Input0
no
Input data records to be mapped to component attributes.Any
Output0
yes
One record per each entry in the target directoryAny
1
no
ErrorsAny

Metadata

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

The component has metadata templates available. See Details or general info on Metadata Templates.

ListFiles Attributes

AttributeReqDescriptionPossible values
Basic
File URLyes [1] The path to the file or directory to be listed (see Supported URL Formats for File Operations).  
RecursivenoList subdirectories recursively. (Has no effect if List directory contents is set to false.) false (default) | true
Input mapping [2] Defines mapping of input records to 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
Advanced
List directory contentsnoIf set to false, returns information about the directory, not its contents.true (default) | false
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. 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 
recursiveRecursivebooleantrue | false
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 input record and result record are mapped to output by name.

Field NameTypeDescription
URLstringURL of the file or directory.
namestringFile name.
canReadbooleanTrue if the file can be read.
canWritebooleanTrue if the file can be modified.
canExecutebooleanTrue if the file can be executed.
isDirectorybooleanTrue if the file exists and is a directory.
isFilebooleanTrue if the file exists and is a regular file.
isHiddenbooleanTrue if the file is hidden.
lastModifieddateThe time that the file was last modified.
sizelongTrue size of the file in bytes.
resultbooleanTrue if the operation has succeeded (can be false when Redirect error output is enabled).
errorMessagestringIf the operation has failed, the field contains the error message (used when Redirect error output is enabled).
stackTracestringIf 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 input record and result record are mapped to output by name.

Field NameTypeDescription
resultbooleanWill always be set to false.
errorMessagestringThe error message.
stackTracestringThe stack trace of the error.

Examples

Listing Files
Working with directories

Listing Files

List files in ${DATATMP_DIR} directory. Do not list content of subdirectories.

Solution

Use File URL and Input mapping attributes.

AttributeValue
File URL${DATATMP_DIR}
Input mappingSee the code below.
function integer transform() {
 	$out.0.* = $in.1.*;

 	return ALL;
}

You need an edge connected to the first output port.

Working with directories

We have the following directory tree structure:

  1. Check if the Clients directory exists.

  2. List the contents of the Clients directory.

  3. List the contents of any existing subdirectories in the Clients directory.

Solution

Use the File URL, Recursive and List directory contents attributes.

AttributeValue
File URL${DATAIN_DIR}/Clients/
List directory contentsfalse
Recursivefalse (default)

Enable debugging on edges and run the graph. The graph has confirmed the directory exists:

Next, set the List directory contents to true (default) and run the graph again. The graph has now listed the contents of the Clients directory:

Now, set the Recursive attribute to true and run the graph.

The graph has now listed the contents of the Clients directory and all subdirectories:

Compatibility

VersionCompatibility Notice
4.6.0-M1The List directory contents attribute has been implemented.

See also

Common Properties of Components
Specific Attribute Types
Common Properties of File Operations
File Operations Comparison