# append (FTP command)

## Overview

The `append` command takes the incoming payload (either from another file on your remote server or some other source) and appends this content to a specified file on the remote server.

## 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), three fields should be updated:

| FTP command                | Root                                                                                                                                                                          | Path                                                                                          |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| FTP command only: `append` | The root to the directory where the source file is located. You could enter just `/` and then a full path in the  `path` field, or you can provide the full path as the root. | The source file (i.e. the file which contains content you want to append to the target 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><div><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F7CfRWz1GKhkNMXXeo7W7%2Fappend%20-%20sample%20flow.png?alt=media&#x26;token=de15007d-f19d-4f8e-a1e4-ce50f0c795c3" 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><p>In this flow, we have three SFTP shapes, each with a different task:</p><p></p><p><strong>SFTP shape 1</strong><br>Retrieve the a list of fruit from a <code>summer.txt</code> file from <code>/myfiles/folderA</code> </p><p></p><p><strong>SFTP shape 2</strong><br>Append this content this to another list of fruit in a file named <code>winter.txt</code>, which is also stored in <code>/myfiles/folderA</code>:</p><div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F9zyjEIzTExYqZam1VTed%2Fappend%20-%20sftp.png?alt=media&#x26;token=0ae45d90-a84e-4d24-9cba-9700f4e6cfc4" alt=""><figcaption></figcaption></figure></div><p><strong>SFTP shape 3</strong><br>Get the full list of fruit from <code>winter.txt</code> and load it into the flow. </p></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 for SFTP shape 1</strong></p><p>Our first SFTP shape is configured to retrieve content to append, from <code>/myfiles/folderA/summer.txt</code> . Connector settings are defined using a <code>get</code> command, 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%2FhcM13kRIPRnZ66ZYAfOp%2Fsftp%20shape%201.png?alt=media&#x26;token=20ba4a67-4d03-4907-bc02-9e1a89b8da66" 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%2Fj6MRefKqIGHibXcacRDK%2F1.png?alt=media&#x26;token=b29dc3c5-6a7d-406c-b1ea-4a42fa659f86">1.png</a></td></tr><tr><td><p><strong>Payload from SFTP shape 1</strong></p><p>When the process flow is run, the payload for our first SFTP shape shows the content in <code>/myfiles/folderA/summer.txt</code> :</p><div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fab8ePPpcKJGFvxXV2HRx%2Fsftp%20shape%201%20payload.png?alt=media&#x26;token=97e3fad0-2e2c-4f17-99ac-42c54c66d78a" alt=""><figcaption></figcaption></figure></div><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><tr><td><p><strong>Connector settings for SFTP shape 2</strong></p><p>Our second SFTP shape is configured to append the current payload to our target file on the remote server -  <code>/myfiles/folderA/winter.txt</code> . Connector settings are defined 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%2FfM0jVzGbYcVKF3qexAsI%2Fsftp%20shape%202.png?alt=media&#x26;token=82af0cf2-dadf-43bd-aded-998567e9a131" 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%2FFGZGpJpRS5MqirFAp1J0%2F3.png?alt=media&#x26;token=1bf1b9f1-37ca-4926-9abc-121b4566bad7">3.png</a></td></tr><tr><td><p><strong>Payload from SFTP shape 2</strong></p><p>When the process flow is run, the payload for our second SFTP shape shows just a <code>1</code>: </p><div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FZ9ubCxTZkCXlr8flQ4kt%2Fsftp%20shape%202%20payload.png?alt=media&#x26;token=44eb31f3-ec8d-451a-976b-2b693c5c65f2" alt=""><figcaption></figcaption></figure></div><p>A <code>1</code> indicates a successful response from your remote server. A <code>0</code> indicates an unsuccessful response from your remote server. </p></td><td><a href="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F1sBuktAYYYZ0nCDuTbFW%2F4.png?alt=media&#x26;token=d2d962da-b7d9-4937-9d54-57824613007f">4.png</a></td></tr><tr><td><p><strong>Connector settings for SFTP shape 3</strong></p><p>Our final SFTP shape is configured to retrieve our target file from the remote server -  <code>/myfiles/folderA/winter.txt</code> . Connector settings are defined using a <code>get</code> command, as follows:<br><br><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FO3DpPo9dsN4sj9tXA9JW%2Fsftp%20shape%203.png?alt=media&#x26;token=0d6171a8-a1bd-438f-a08a-8a0dc39cf71a" alt=""></p></td><td><a href="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FA3BkKRNbMlGfSlZaoO3q%2F5.png?alt=media&#x26;token=43be303f-79c7-4fc9-950a-7e0ccfdb836e">5.png</a></td></tr><tr><td><p><strong>Payload from SFTP shape 3</strong></p><p>When the process flow is run, the payload for our final SFTP shape shows the content in <code>/myfiles/folderA/winter.txt</code> :</p><div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fy0XZ8yNjGPGqybZxf6Ew%2Fsftp%20shape%203%20payload.png?alt=media&#x26;token=b8ddc8f7-5386-497f-ad40-025d91669a5c" alt=""><figcaption></figcaption></figure></div><p>Here we can see that content from <code>/myfiles/folderA/summer.txt</code> has ben appended to original content in <code>/myfiles/folderA/winter.txt</code>.</p></td><td><a href="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FEOf7GwzaaFhgM0Rjregb%2F6.png?alt=media&#x26;token=ccf6e7e3-aaea-47c9-bc6c-7fbe5630f53a">6.png</a></td></tr></tbody></table>
