> For the complete documentation index, see [llms.txt](https://doc.wearepatchworks.com/product-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape/configuring-sftp-connections/valid-ftp-commands/delete-ftp-command.md).

# delete (FTP command)

### Overview

The `delete` command deletes a file from a given location on the remote server. No content is loaded into the flow.

## Need to know

Regular expressions are supported when defining files to be removed with the `delete` command.

## Connection settings

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

| FTP command                | Root                                                                                                                                                                                                                                                                                                                                                                   | Path                                                                                                        |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| FTP command only: `delete` | <p>The root to the directory where the required file is located. You could enter just <code>/</code> and then a full path in the <code>path</code> field, or you can provide the full path to the file.<br><br>If you are deleting multiple files using a regular expression, enter the entire path here, so the path field only contains your regular expression.</p> | The filename or regular expression (if you specified the full path as `root`) or the full path to the file. |

## 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><p><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FasY30d6ov6H1ojkAjpS3%2Fdelete%20-%20flow.png?alt=media&amp;token=a678c330-4006-49ff-b6d4-0a38f9cd019c" alt="" data-size="original"></p></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&amp;token=bfe93287-e388-4fc4-98d4-9f7f4d4ad145">patchworks tile.png</a></td></tr><tr><td>In this flow, we need to delete all files that start with 'old' 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%2Fq2IUPONLbaDVsYEqQISR%2Fdelete%20-%20files%20before.png?alt=media&amp;token=c860c536-bbfe-478b-ad31-97a3ab860db4" 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&amp;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><p><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fg9gdlHFq9yHrRLzWLe8v%2Fdelete%20-%20connector%20-%20regex.png?alt=media&amp;token=49baab68-1760-4a73-aa79-4d7258ae0c0e" alt="" data-size="original"></p><ul><li>Look for files from the <code>root</code>, which is defined as: <code>/myfiles/folderB</code></li><li>Check the <code>path</code> for the file(s) to remove, defined as: <code>/^old.*/i</code></li><li>Delete files with the <code>ftp command</code>. This is defined as: <code>delete</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&amp;token=b29dc3c5-6a7d-406c-b1ea-4a42fa659f86">1.png</a></td></tr><tr><td>On our remote server, all files starting with 'old' have been removed from <code>/myfiles/folderB/</code>:<br><br><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FHMr2lDWRx7aHoW1kG5BF%2Fdelete%20-%20files%20after.png?alt=media&amp;token=1def4dd1-8d7e-47dc-8e6e-04a2fad9edcd" alt=""></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&amp;token=0364622b-8254-4551-9a68-9e2f142f330f">2.png</a></td></tr></tbody></table>
