# Remove File

### Overview

The **Remove File Component** allows users to delete a file from an FTP or SFTP server. It ensures efficient file management within automated workflows.

### Usage

This component connects to an FTP/SFTP server and removes the specified file.

#### Properties

| Property | Type     | Description                  |
| -------- | -------- | ---------------------------- |
| `path`   | `string` | The file path to be removed. |

#### Input Ports

| Port | Description                        |
| ---- | ---------------------------------- |
| `in` | Accepts the file path for removal. |

#### Output Ports

| Port       | Description                                                        |
| ---------- | ------------------------------------------------------------------ |
| `out`      | Emits success confirmation when the file is removed.               |
| `notFound` | Emits an error if the file does not exist or permission is denied. |

#### Processing Logic

1. **Establishes FTP/SFTP Connection**: Securely connects to the remote server using provided authentication credentials.
2. **Attempts to Remove File**:
   * Tries to delete the file at the specified `path`.
   * Ensures proper handling of file permissions.
3. **Handles Success & Errors**:
   * If successful, sends confirmation to the `out` port.
   * If the file does not exist or permission is denied, emits an error to `notFound` with details.
4. **Closes Connection**: Ensures the FTP/SFTP session is properly terminated.

#### Output Data Schema

| Property                  | Type     | Description                           |
| ------------------------- | -------- | ------------------------------------- |
| `path`                    | `string` | The file path that was processed.     |
| `errorCode` (if error)    | `string` | FTP/SFTP error code.                  |
| `errorMessage` (if error) | `string` | Description of the error encountered. |

### Notes

* **Supports FTP & SFTP**: Works with both FTP and secure FTP (SFTP) connections.
* **Error Handling**: Properly manages missing files and permission-related issues.
* **Efficient File Management**: Enables automated cleanup of remote files.

This component is essential for workflows that require automated file deletion on remote servers.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.appmixer.com/connector-configuration/utils/ftp/remove-file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
