# 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: 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/get-file-info.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.
