> For the complete documentation index, see [llms.txt](https://docs.appmixer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appmixer.com/connector-configuration/utils/ftp/get-file-info.md).

# Get File Info

### Overview

The **Get File Info Component** retrieves metadata about a specific file from an FTP or SFTP server, allowing workflows to analyze file details before further processing.

### Usage

This component connects to an FTP/SFTP server, fetches metadata for a specified file, and provides information about its name, size, modification time, and permissions.

#### Input Ports

| Port | Description                                                   |
| ---- | ------------------------------------------------------------- |
| `in` | Receives the file path for which metadata is to be retrieved. |

#### Output Ports

| Port       | Description                                                            |
| ---------- | ---------------------------------------------------------------------- |
| `out`      | Emits the file's metadata, including name, type, size, and timestamps. |
| `notFound` | Emits an error if the file is not found or access is denied.           |

#### Properties

| Property | Type     | Description                                                |
| -------- | -------- | ---------------------------------------------------------- |
| `path`   | `string` | The full remote file path for which metadata is requested. |

#### Processing Logic

1. **Establishes FTP/SFTP Connection**: Connects to the remote server using provided authentication.
2. **Retrieves File Metadata**:
   * Checks if the specified file exists.
   * Retrieves details such as name, size, and modification time.
3. **Handles Success & Errors**:
   * If successful, outputs file metadata to the `out` port.
   * If the file is missing or access is denied, sends an error message to `notFound`.
4. **Closes Connection**: Ensures the connection is terminated after execution.

#### Output Data Schema

| Property                   | Type     | Description                                         |
| -------------------------- | -------- | --------------------------------------------------- |
| `name`                     | `string` | The name of the file.                               |
| `type`                     | `number` | Indicates whether it is a file or directory.        |
| `size`                     | `number` | The size of the file in bytes.                      |
| `modifiedAt`               | `number` | The timestamp of the last modification.             |
| `rawModifiedAt` (FTP only) | `number` | The raw modification timestamp.                     |
| `modifyTime` (SFTP only)   | `number` | The modification time of the file.                  |
| `accessTime` (SFTP only)   | `number` | The last access time of the file.                   |
| `rights` (SFTP only)       | `object` | The file's access permissions (user, group, other). |
| `longname` (SFTP only)     | `string` | A detailed description of file properties.          |
| `path` (if error)          | `string` | The requested file path if not found.               |
| `errorCode` (if error)     | `string` | The 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.
* **Comprehensive Metadata**: Retrieves essential details like size, timestamps, and permissions.
* **Error Handling**: Detects missing files and permission errors, sending appropriate error messages.

This component is useful for workflows requiring file validation before downloading or processing.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.appmixer.com/connector-configuration/utils/ftp/get-file-info.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
