# SFTP

> Upload, download, list, move and delete files on any server that speaks SFTP (file transfer over SSH): a hosting account, a bank's or supplier's file drop, a NAS, or a legacy system's export folder.

App · 5 actions. Web page: https://docs.lodol.com/docs/integrations/sftp

## Actions

### Delete a file

Delete a file from the server, or an empty folder, such as an export once it has been processed.

**Inputs**

- Path (`path`, text, required): The full path of the file to delete, such as /incoming/report.csv. A folder is deleted only when it is empty.
- If there is no such file (`if_missing`, text): What to do when nothing is at that path: stop the workflow, or carry on, which suits a cleanup step that may run more than once. One of: `fail` (Stop the workflow), `ignore` (Carry on). Default: `fail`.

**Outputs**: Whether something was deleted.

- `deleted` (true/false): True when a file or folder was deleted; false when there was nothing there and the step carried on.
- `path` (text): The path that was deleted.

**Example output**

```json
{
  "deleted": true,
  "path": "/exports/report.csv"
}
```

### Download a file

Fetch a file from the server and store it, ready to read with Read a file, attach to an email, or upload somewhere else. Files are kept for 30 days.

**Inputs**

- Path (`path`, text, required): The file's full path on the server, such as /exports/report.csv. Use List files to find it.

**Outputs**: The downloaded file, stored for 30 days. Pass document_ref to any step that takes a file, or documents to one that takes several, such as an email's attachments.

- `content_type` (text): The file's type, worked out from its name.
- `document_ref` (text): The stored file's id, for later steps.
- `documents` (list): The same file as a one-entry list, the shape a download step returns.
- `filename` (text): The file's name.
- `modified_at` (text): When the file was last changed on the server, in UTC.
- `path` (text): Where it was on the server.
- `size_bytes` (number): The file's size.

**Example output**

```json
{
  "content_type": "text/csv",
  "document_ref": "doc_7f3b2c9e4d1a4f0b8e6c5a1d2b3c4d5e",
  "documents": [
    {
      "content_type": "text/csv",
      "document_ref": "doc_7f3b2c9e4d1a4f0b8e6c5a1d2b3c4d5e",
      "filename": "report.csv",
      "size_bytes": 18422
    }
  ],
  "filename": "report.csv",
  "modified_at": "2026-03-09T06:00:12Z",
  "path": "/exports/report.csv",
  "size_bytes": 18422
}
```

### List files

See what a folder on the server holds: each file and folder with its path, size and when it last changed. Go through the list with a Repeat for each to download, move or delete each file.

**Inputs**

- Folder (`folder`, text, required): The folder on the server, such as /uploads. A path without a leading / is inside the folder the account lands in when it signs in, and . is that folder itself.
- Include files in subfolders (`recursive`, true/false): Also list what each folder inside it holds, all the way down. Default: `false`.

**Outputs**: The folder's entries, folders included, in name order.

- `count` (number): How many entries were listed.
- `files` (list): One entry per file or folder: name, path, type (file or folder), size_bytes (files only), modified_at, and link, true for a link, which is listed as what it points to (type link when that can't be reached).
- `folder` (text): The folder that was listed.
- `truncated` (true/false): True when the folder holds more than 10,000 entries and only the first of them are listed.

**Example output**

```json
{
  "count": 2,
  "files": [
    {
      "link": false,
      "modified_at": "2026-03-09T06:00:12Z",
      "name": "report.csv",
      "path": "/exports/report.csv",
      "size_bytes": 18422,
      "type": "file"
    },
    {
      "link": false,
      "modified_at": "2026-02-28T17:45:03Z",
      "name": "archive",
      "path": "/exports/archive",
      "size_bytes": null,
      "type": "folder"
    }
  ],
  "folder": "/exports",
  "truncated": false
}
```

### Move or rename a file

Move a file into another folder, give it a new name, or both, such as moving a processed export into an archive folder. The destination folder is created if it isn't there.

**Inputs**

- Path (`path`, text, required): The file's current full path on the server, such as /incoming/report.csv.
- New path (`new_path`, text, required): Where the file goes: its new full path, such as /archive/report-march.csv, or an existing folder, such as /archive, to move it there under its own name.
- If a file is already there (`if_exists`, text): What to do when a file with that name already exists at the destination: replace it, or stop the workflow so nothing is overwritten. One of: `replace` (Replace it), `fail` (Stop the workflow). Default: `replace`.

**Outputs**: Where the file is now.

- `filename` (text): Its name now.
- `folder` (text): The folder it is in now.
- `path` (text): The file's full path now.
- `previous_path` (text): Where it was.
- `replaced` (true/false): Whether a file at the new path was replaced.

**Example output**

```json
{
  "filename": "report-2026-03-09.csv",
  "folder": "/archive",
  "path": "/archive/report-2026-03-09.csv",
  "previous_path": "/exports/report.csv",
  "replaced": false
}
```

### Upload a file

Put a file on the server: an upload, an email attachment, or a file an earlier step made or downloaded. The folder is created if it isn't there yet, and the file keeps its own name unless you give it another.

**Inputs**

- File (`file`, text, required): The file to upload. Upload one, or pick a file from an earlier step, such as an email attachment or a file Create a file made.
- Folder (`folder`, text, required): The folder on the server, such as /uploads. A path without a leading / is inside the folder the account lands in when it signs in, and . is that folder itself. It is created, with any folders above it, if it doesn't exist.
- File name (`filename`, text): The name to save the file under, such as report.csv. Leave it empty to keep the file's own name.
- If a file is already there (`if_exists`, text): What to do when a file with that name already exists at the destination: replace it, or stop the workflow so nothing is overwritten. One of: `replace` (Replace it), `fail` (Stop the workflow). Default: `replace`.

**Outputs**: Where the file was put on the server.

- `filename` (text): The name it was saved under.
- `folder` (text): The folder it was put in.
- `path` (text): The file's full path on the server.
- `replaced` (true/false): Whether a file of that name was already there and was replaced.
- `size_bytes` (number): How many bytes were uploaded.

**Example output**

```json
{
  "filename": "report.csv",
  "folder": "/uploads",
  "path": "/uploads/report.csv",
  "replaced": false,
  "size_bytes": 18422
}
```
