# list (FTP command)

### Overview

The `list` command lists files in a given directory. The listing is loaded into the flow as a payload (where each filename is listed in an array).  &#x20;

## Need to know

Regular expressions are not supported for the `list` command - it should only be used to list all files in a given directory. If you need to work with a specific group of files, you may find the [get](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape/configuring-sftp-connections/valid-ftp-commands/get-ftp-command) command useful.

## Connection settings

When [configuring an SFTP connector](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape/configuring-sftp-connections), two fields should be updated:

| FTP command              | Root                                                                                                                                                      | Path          |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| FTP command only: `list` | <p>The root to the directory you want to list.<br><br>Since there is no specific file to consider, the full path to the directory will be the root.  </p> | Not required. |

## Example

* [Scenario](#scenario)
* [The steps](#the-steps)

### Scenario

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><p>Our process flow is configured as follows:</p><div><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F0GEIIW4FBxp6FiNukxbN%2Flist%20-flow.png?alt=media&#x26;token=3ff19e96-dc5b-4d22-ab97-f291b63bc031" alt=""><figcaption></figcaption></figure></div></td><td><a href="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fn8hT31RXr15yDkexZJE3%2Fpatchworks%20tile.png?alt=media&#x26;token=bfe93287-e388-4fc4-98d4-9f7f4d4ad145">patchworks tile.png</a></td></tr><tr><td>In this flow, we need to list all files in <code>/myfiles/folderB</code> on the remote server:<br><br><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FytJvMv3ioRHz2FqL6tc4%2Flist%20-%20files%20before.png?alt=media&#x26;token=67e385b2-5153-422f-b702-04ae54816913" alt=""></td><td><a href="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FLk4y0aH1PczueqSMTLXB%2Fsftp%20tile.png?alt=media&#x26;token=09c2c0cd-72cc-4c34-b43e-a494256f60d5">sftp tile.png</a></td></tr></tbody></table>

### The steps

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><p><strong>Connector settings</strong></p><p>Our SFTP shape is configured as follows: </p><div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FymJ1d1dGjx3yPXUivPQo%2Flist%20-%20connector%20settings.png?alt=media&#x26;token=8ab1017f-4b9d-48d8-bc97-1e887b93ad86" alt=""><figcaption></figcaption></figure></div><ul><li>List all files in the <code>root</code>, which is defined as: <code>/myfiles/folderB/</code></li></ul></td><td><a href="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fj6MRefKqIGHibXcacRDK%2F1.png?alt=media&#x26;token=b29dc3c5-6a7d-406c-b1ea-4a42fa659f86">1.png</a></td></tr><tr><td><p>On our remote server, all files in <code>/myfiles/folderB/</code> are loaded into the flow as a payload, with files in an array:<br><br><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FZzVz8Dx9GHKp6bx7T5wS%2Flist%20-%20payload.png?alt=media&#x26;token=5bc9e4f2-a31c-4533-bea7-b6267ad92fa7" alt=""></p><p></p></td><td><a href="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FHGWG2ZNqxBfnjG0EpNCG%2F2.png?alt=media&#x26;token=0364622b-8254-4551-9a68-9e2f142f330f">2.png</a></td></tr></tbody></table>
