> For the complete documentation index, see [llms.txt](https://docs.frends.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.frends.com/tasks/tasks/ftp/listfiles.md).

# ListFiles

Task version: 2.0.0

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.FTP>

## Task Parameters

{% tabs %}
{% tab title="Input" %}

| Name                              | Description                                                                                                                                                                                                                                                                                                                                                                                      |                                                               |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------- |
| Directory : `String`              | <p>Path to file(s).</p><p><br>Default: <code>/</code><br>Example: <code>/ , /SubDir</code></p>                                                                                                                                                                                                                                                                                                   |                                                               |
| FileMask : `String`               | <p>FileMask.</p><p>The file mask uses regular expressions and for convenience it handles \* and ? like wildcards (regex .\* and .+).</p><p>Parameter can begin with . For example: ^(?!prof).<em>\_test.txt is same as ^(?!prof).</em>\_test.txt).</p><p>Use \* or leave empty to list all files.</p><p><br>Default: <code>-</code><br>Example: <code>test.txt, test\*.txt, test?.txt, test.(txt | xml), test.\[^t]\[^x]\[^t], ^(?!prof).\*\_test.txt</code></p> |
| IncludeType : `IncludeType`       | <p>Types to include in the directory listing.</p><p>Possible values:</p><ul><li><code>File</code>: Types to include in the directory listing.</li><li><code>Directory</code>: Types to include in the directory listing.</li><li><code>Both</code>: Types to include in the directory listing.</li></ul><p><br>Default: <code>0</code><br>Example: <code>IncludeType.File</code></p>             |                                                               |
| IncludeSubdirectories : `Boolean` | <p>Include subdirectories?</p><p><br>Default: <code>-</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                   |                                                               |
| {% endtab %}                      |                                                                                                                                                                                                                                                                                                                                                                                                  |                                                               |

{% tab title="Connection" %}

| Name                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Address : `String`                     | <p>FTP(S) host address</p><p><br>Default: <code>-</code><br>Example: <code>my.ftp.server.com</code></p>                                                                                                                                                                                                                                                                                                                                                                                               |
| Port : `Int32`                         | <p>Port number to use in the connection to the server.</p><p><br>Default: <code>21</code><br>Example: <code>21</code></p>                                                                                                                                                                                                                                                                                                                                                                             |
| UserName : `String`                    | <p>Username to use for authentication to the server. Note that the file endpoint only supports</p><p>username for remote shares and the username must be in the format DOMAIN\Username.</p><p><br>Default: <code>-</code><br>Example: <code>myUsername</code></p>                                                                                                                                                                                                                                     |
| 🗝Password : `String`                  | <p>Password to use in the authentication to the server.</p><p><br>Default: <code>-</code><br>Example: <code>myPassword</code></p>                                                                                                                                                                                                                                                                                                                                                                     |
| Mode : `FtpMode`                       | <p>Connection mode to use to connect to the FTP server</p><p>Possible values:</p><ul><li><code>Passive</code>: Connection mode to use to connect to the FTP server</li><li><code>Active</code>: Connection mode to use to connect to the FTP server</li></ul><p><br>Default: <code>0</code><br>Example: <code>FtpMode.Passive</code></p>                                                                                                                                                              |
| KeepConnectionAliveInterval : `Int32`  | <p>Sends NOOP command to keep connection alive at specified time-interval in seconds. If set to 0 the connection is not kept alive. Default value is 0</p><p><br>Default: <code>0</code><br>Example: <code>60</code></p>                                                                                                                                                                                                                                                                              |
| ConnectionTimeout : `Int32`            | <p>The length of time, in seconds, until the connection times out. You can use value 0 to indicate that the connection does not time out. Default value is 60 seconds</p><p><br>Default: <code>60</code><br>Example: <code>60</code></p>                                                                                                                                                                                                                                                              |
| UseFTPS : `Boolean`                    | <p>Whether to use FTPS or not.</p><p><br>Default: <code>false</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                               |
| SecureDataChannel : `Boolean`          | <p>Whether the data channel is secured or not.</p><p><br>Default: <code>true</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                |
| SslMode : `FtpsSslMode`                | <p>Specifies whether to use Explicit or Implicit SSL.</p><p>Possible values:</p><ul><li><code>None</code>: Specifies whether to use Explicit or Implicit SSL.</li><li><code>Explicit</code>: Specifies whether to use Explicit or Implicit SSL.</li><li><code>Implicit</code>: Specifies whether to use Explicit or Implicit SSL.</li><li><code>Auto</code>: Specifies whether to use Explicit or Implicit SSL.</li></ul><p><br>Default: <code>0</code><br>Example: <code>FtpsSslMode.None</code></p> |
| EnableClientAuth : `Boolean`           | <p>If enabled the client certificate is searched from user's certificate store.</p><p><br>Default: <code>false</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                              |
| ClientCertificateName : `String`       | <p>Optional. Enables certification search by name from the certification store of current user.</p><p><br>Default: <code>-</code><br>Example: <code>mycert.crt</code></p>                                                                                                                                                                                                                                                                                                                             |
| ClientCertificateThumbprint : `String` | <p>Optional. Enables certification search by thumbprint from the certification store of current user.</p><p><br>Default: <code>-</code><br>Example: <code>a909502dd82ae41433e6f83886b00d4277a32a7b</code></p>                                                                                                                                                                                                                                                                                         |
| ValidateAnyCertificate : `Boolean`     | <p>If enabled the any certificate will be considered valid.</p><p><br>Default: <code>false</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                  |
| ClientCertificatePath : `String`       | <p>Path to client certificate (X509).</p><p><br>Default: <code>-</code><br>Example: <code>c:\example.cer</code></p>                                                                                                                                                                                                                                                                                                                                                                                   |
| CertificateHashStringSHA1 : `String`   | <p>Certificate SHA1 hash string to validate against.</p><p><br>Default: <code>-</code><br>Example: <code>BA7816BF8F01CFEA414140DE5DAE2223B00361A3</code></p>                                                                                                                                                                                                                                                                                                                                          |
| {% endtab %}                           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| {% endtabs %}                          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

## Task Result

| Name                     | Description                                                                                                                                                                                          |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Files : `List<FileItem>` | <p>List of files.<br>Example: <code>\[ { "test.txt", "/ListFiles/test.txt", "2022-05-20T13:21:42Z", 1048576 }, { "test2.txt", "/ListFiles/test2.txt", "2022-05-20T13:21:42Z", 1048576 } ]</code></p> |

## Task Changelog

Changelog for Task Frends.FTP.ListFiles.

### \[2.1.0] - 2024-08-23

#### Changed

* Updated the Newtonsoft.Json package to version 13.0.3.

### \[2.0.0] - 2022-12-20

#### Fixed

* Fixed documentation
* Fixed Tests and change the Tests to use docker container.
* Fixed error handling to throw specific errors from the library and not custom.

#### Added

* Created Connection class for connection parameters.
* Added FTPS options.
* Added FtpMode and FtpsSslMode
* Added feature which enables the Task to get files, directories or both.
* Added feature which enables the Task to get files from subdirectories.
* Added possibility to use certificates.

#### Changed

* Changed return object to a List of FileItems.
* Renamed most of the parameters.
* Changed the target framework to .net6.
* Changed the Task to async method.

### \[1.0.0] - 2022-05-18

#### Added

* Initial implementation


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.frends.com/tasks/tasks/ftp/listfiles.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
