Skip to content

List Files in Folder

This Step helps retrieve file data (e.g., name, size, creation and modification time, link, etc.) of every public and private file in the defined folder of the Files service in your OneReach.ai account. You choose the folder to list the files from and whether to include their URLs in the output. When the Flow reaches this Step during its execution, it lists all found data in its output, and the Flow proceeds down the "next" exit. An option to select the Flow behavior in case the defined path doesn’t exist is available. To list the files in another OneReach.ai account, use Cross-account settings.

Prerequisites

To access another OneReach.ai account, make sure you meet the following requirements:

  • Your account has the Super Admin role
  • Your Flow has the Super Admin Flow permission level
  • You have an Account ID or User/Flow Authentication token related to the OneReach.ai account you want to access

File settings

To set up this section, take the following steps:

  1. Provide the folder from which to retrieve the list of files.
  2. Optionally, turn on the toggle to return download URLs of each file in the output of the Step.

File folder

To retrieve the files from the folder within Files of your OneReach.ai account, click Select folder, then choose the folder in the popup window.

Alternatively, the folder can be defined in the folder field in the foldername/ format. Use / as the divider.

TIP

Enter the / character to list all files stored in the Files service.

TIP

To list files in a folder of another Onereach.ai account, we recommend providing the path using the foldername/ format.

Return download URLs

By default, the Step will not add the download URLs of the listed files to its output. If this data is needed further in the Flow, turn on the respective toggle.

Conflict handling

If the defined path doesn’t exist, the Flow will proceed down the "not found" exit. Select the "next" or "error" option in the dropdown to take the Flow down the respective exit.

TIP

The "not found" exit is removed from the Flow tree if a different exit is selected.

Cross-account settings

By default, you can upload a file only to your OneReach.ai account. To upload a file to a different OneReach.ai account, do the following:

  1. Make sure that your OneReach.ai account has the Super Admin role. To check your role, go to Action desk -> Users. The role is defined under the user name. If your role isn't Super Admin, contact OneReach.ai support to change it.
  2. Go to the General tab of the Flow, then open Deployment settings -> Flow permissions level and select Super Admin.
  3. Turn on the Use custom authentication token toggle.
  4. Choose one of the access types and provide respective data:
  • For the Authentication token type, select the USER or FLOW type and provide the respective token. Reach out to OneReach.ai support to obtain the value for this token.
  • For the Account ID type, provide the Account ID of the user you wish to access. The Account ID value is a unique UUID v4 format string value generated for each OneReach.ai account. You can find the option to Copy the account ID in the Profile settings of the OneReach.ai window under the Current account label.
  1. Save and activate the Flow.

Merge field settings

The Step returns the result as a JSON object and stores it in the Merge field, which contains two arrays of public and private file data, each consisting of the properties below. To learn more about Merge fields, their types, and how to work with them, follow this link.

KeyTypeDescription
publicArrayAn array of objects, each includes data about a public file in the selected folder.
privateArrayAn array of objects, each includes data about a private file in the selected folder.
keyStringThe file path to the respective file.
sizeNumberThe size of the respective file in bytes.
urlStringThe link to the respective file in Files.
contentTypeStringThe file type and extension in type/extension format.
createdAtNumberThe respective file’s time of creation in timestamp format.
updatedAtNumberThe respective file’s time of last modification in timestamp format.
ttlNumberThe auto-delete date of the uploaded file in timestamp format.
parentFolderStringThe folder name of the folder to which the respective file belongs.
lastModifiedNumberThe respective file’s time of last modification in timestamp format. Present to support backward compatibility.

See below an example of the Merge field object’s structure:

JSON
{
  "public": [{
    "key": "Test/valid.json",
    "isPublic": true,
    "size": 9,
    "contentType": "application/json",
    "parentFolder": "Test/",
    "createdAt": 1680181089061,
    "updatedAt": 1680181089061,
    "autoDelete": null,
    "lastModified": 1680181089061,
    "url": "https://files.staging.api.onereach.ai/public/af17-f0b5-4383-a7d7-5832a56ea/Test/json.json"
  }],
  "private": [{
    "key": "Test/invalid.json",
    "isPublic": false,
    "size": 5,
    "contentType": "application/json",
    "parentFolder": "Test/",
    "createdAt": 1680601474772,
    "updatedAt": 1680601474772,
    "ttl": 1684581090739,
    "lastModified": 1680601474772,
    "url": "https://files.staging.api.onereach.ai/af17-f0b5-4383-a7d7-5832a546ea/Test/test.json?Expires=1682075528&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9maWxlcy5zdGFnaW5nLmFwaS5vbmVyZWFjaC5haS9hYmI5YWYxNy1mMGI1LTQzODMtYTdkiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTY4MjA3NTU8VavCP6qU4Z5W5ZjqvI1-NHiqMpuk6o7xXivnqWkUQ5OkbWA4ZyOcP02iwAhlTD-2Ti86nS~QQEfrFpKPnYBNpRNu~nhK7fioxgem97tRaMrm3eoVigh2OzK4oJs~epUB3btB1gPKw8tTjSUD03PeUXjQBBbE6t2fMA7-puJpHA7A5DNDzI6mTmppaosPnYBcCrDO-AuCRmg6C8xRA6i5yBezPyCkwK4AIMsc1CId6n9MzNRDb23wjahV0T3rDnpOugcc4cgJ9e3kYAqrcik8g4NCdCnuRSZQiVNk9GAeyEg__&Key-Pair-Id=K33HFYYO5LG4DE"
  }]
}
{
  "public": [{
    "key": "Test/valid.json",
    "isPublic": true,
    "size": 9,
    "contentType": "application/json",
    "parentFolder": "Test/",
    "createdAt": 1680181089061,
    "updatedAt": 1680181089061,
    "autoDelete": null,
    "lastModified": 1680181089061,
    "url": "https://files.staging.api.onereach.ai/public/af17-f0b5-4383-a7d7-5832a56ea/Test/json.json"
  }],
  "private": [{
    "key": "Test/invalid.json",
    "isPublic": false,
    "size": 5,
    "contentType": "application/json",
    "parentFolder": "Test/",
    "createdAt": 1680601474772,
    "updatedAt": 1680601474772,
    "ttl": 1684581090739,
    "lastModified": 1680601474772,
    "url": "https://files.staging.api.onereach.ai/af17-f0b5-4383-a7d7-5832a546ea/Test/test.json?Expires=1682075528&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9maWxlcy5zdGFnaW5nLmFwaS5vbmVyZWFjaC5haS9hYmI5YWYxNy1mMGI1LTQzODMtYTdkiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTY4MjA3NTU8VavCP6qU4Z5W5ZjqvI1-NHiqMpuk6o7xXivnqWkUQ5OkbWA4ZyOcP02iwAhlTD-2Ti86nS~QQEfrFpKPnYBNpRNu~nhK7fioxgem97tRaMrm3eoVigh2OzK4oJs~epUB3btB1gPKw8tTjSUD03PeUXjQBBbE6t2fMA7-puJpHA7A5DNDzI6mTmppaosPnYBcCrDO-AuCRmg6C8xRA6i5yBezPyCkwK4AIMsc1CId6n9MzNRDb23wjahV0T3rDnpOugcc4cgJ9e3kYAqrcik8g4NCdCnuRSZQiVNk9GAeyEg__&Key-Pair-Id=K33HFYYO5LG4DE"
  }]
}

In case the defined path doesn’t exist, the Merge field value depends on the exit:

  • next
JSON
{
  "public": [],
  "private": []
}
{
  "public": [],
  "private": []
}
  • not found - null

Error handling

By default, the Step handles errors using a separate exit. If an error occurs during the Step execution, the Flow proceeds down the error exit, e.g., in case the Files service is unavailable. For more information on error handling, follow this link.

Reporting

The Step automatically generates Reporting events during its execution, allowing for real-time tracking and analysis of its performance and user interactions. To learn more about Reporting events, follow this link.