List

List hooks allow you to retrieve file and directory listings from any supported filesystem connection. This is particularly useful for discovering files, validating directory contents, or preparing for batch operations.

Configuration

- type: list
  location: "aws_s3/path/to/directory"  # Required: Location string
  recursive: false      # Optional: List files/folders recursively (default: false)
  only: files | folders  # Optional: List only files or only folders
  into: my_variable    # Optional: Store results in store or env (e.g., "file_list" or "env.FILE_LIST")
  on_failure: abort    # Optional: abort/warn/quiet/skip
  id: my_id           # Optional. Will be generated. Use `log` hook with {runtime_state} to view state.

Properties

Property
Required
Description

location

Yes

The location string. Contains connection name and path.

recursive

No

Whether to list files recursively in subdirectories (default: false)

only

No

Filter to list only "files" or only "folders"

into

No

Store the result array in the replication store or environment variables. Use store.variable_name or just variable_name for store, or env.VARIABLE_NAME for environment variables

on_failure

No

What to do if the listing fails (abort/warn/quiet/skip)

Output

When the list hook executes successfully, it returns the following output that can be accessed in subsequent hooks:

You can access these values in subsequent hooks using the following syntax (jmespath):

  • {state.hook_id.status} - Status of the hook execution

  • {state.hook_id.result} - Array of file/directory entries

  • {state.hook_id.path} - The listed path

  • {state.hook_id.connection} - The connection used

Examples

Process Files in Directory

List files and process them in a group:

Archive Old Files

List and archive files older than a certain date:

Size-based Processing

Process files based on their size:

Store Results for Later Use

Use the into parameter to store list results in the store or environment variables for use across pipeline steps:

Store Results as Environment Variable

Store list results as a JSON environment variable for use in subsequent pipeline steps or replications:

Store File Paths for API Iteration

List files and use their paths to drive API endpoint iteration:

Combined with Query Results

Combine list results with database queries:

Notes

  • Not all filesystems provide all metadata fields

  • Timestamps may be zero if not supported by the filesystem

  • Directory sizes are typically reported as 0

  • The hook will not fail if the path doesn't exist or is empty

  • When using into, the result array is stored directly without the wrapping object (no need to access .result)

  • Use into: "variable_name" for replication store (accessible via {store.variable_name})

  • Use into: "env.VARIABLE_NAME" for environment variables (accessible via {env.VARIABLE_NAME}, stored as JSON string)

Last updated

Was this helpful?