> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/action-center/linux/copy-to.md).

# Copy To

Writes the devices the workflow collected into one JSON file and uploads it with SFTP to a directory on a Linux server. The server is the host of the SSH connection you choose.

### Before you begin

* An SSH connection created and tested in **Action Center** > **Settings** > **SSH Configurations** (see [Action Center Settings](broken://pages/daed11d520fa03d16ef01d2e588ad217dff3e360)). The job runs on that connection's host.
* Asset type: `device` (the default). The job declares no required columns, so every collected device is written.
* The target directory must already exist on the server and be writable by the SSH user. The job does not create it.

### Settings

| Setting        | Type      | Required | Default | Description                                                                                                                                 |
| -------------- | --------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| SSH connection | Selection | Yes      | None    | The SSH connection to run on, chosen by name from the connections you created in **Action Center** > **Settings** > **SSH Configurations**. |
| Target         | Text      | Yes      | None    | Directory on the remote server that the file is uploaded to, for example `/var/data/octo`.                                                  |

The label of the second field is derived from the field name `target`, so the console text may differ slightly.

### How it works

The job runs once per workflow run and writes one file that holds all collected devices, not one file per device.

The file is a JSON list with one entry per device, containing the full device record (`_source`), indented with four spaces. The workflow columns chosen with **Edit Columns** are not applied. The file gets a generated name ending in `.json`, and is uploaded to `<Target>/<generated name>.json` with SFTP. You cannot choose the file name.

If the upload fails, the job fails with `<connection name> SSH cannot copy file: <reason>` and the connection status becomes Failed. If the chosen SSH connection no longer exists, the job fails.

On success the job passes the assets it received on to the next node unchanged.

### Example

```
SSH connection: archive-server
Target:         /var/data/octo
```

Each run adds a new file such as `/var/data/octo/<generated name>.json`.

### What's next?

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>About Action Center</strong></td><td>Workflows, triggers, conditions and job nodes.</td><td><a href="broken://pages/ae3b117733c8a5fb0f9274b4d23b4322d1cb7fad">Broken link</a></td></tr><tr><td><strong>Action Center Settings</strong></td><td>Save default values and SSH connections for jobs.</td><td><a href="broken://pages/daed11d520fa03d16ef01d2e588ad217dff3e360">Broken link</a></td></tr><tr><td><strong>Copy To (Windows)</strong></td><td>Write a CSV or JSON file to a Windows machine over WinRM.</td><td><a href="broken://pages/295826cade7e6ca84e09bfb5cb5e041a4bc8fcad">Broken link</a></td></tr><tr><td><strong>Start Linux Service</strong></td><td>Run systemctl start over SSH.</td><td><a href="broken://pages/84f5c17894e66318c81c17365bc31a9f23ce2548">Broken link</a></td></tr></tbody></table>

{% hint style="info" %}
Available starting from version 6.0.0.
{% endhint %}
