SFTP (SSH File Transfer Protocol) é um protocolo seguro de transferência de arquivos que roda sobre uma conexão SSH, permitindo mover e gerenciar arquivos em um servidor remoto sem expor credenciais ou dados em texto puro. Ele oferece suporte a autenticação via senha ou chave privada, tornando-se uma escolha padrão para troca segura de arquivos com servidores, provedores de hospedagem e sistemas legados.
Com este bloco, você pode:
- Fazer upload de arquivos: Envie arquivos ou conteúdo de texto direto para um diretório em um servidor remoto
- Fazer download de arquivos: Recupere um arquivo do servidor remoto como texto ou conteúdo codificado em base64
- Listar conteúdo de diretórios: Navegue por arquivos e pastas, opcionalmente com metadados detalhados como tamanho e permissões
- Excluir arquivos ou diretórios: Remova arquivos remotos, com exclusão recursiva opcional para pastas
- Criar diretórios: Crie novas pastas no servidor remoto, opcionalmente criando diretórios pai conforme necessário
No Zoen, o bloco SFTP permite que seus agentes façam upload, download, listagem, exclusão e criação de arquivos e diretórios em um servidor remoto, tudo autenticado com senha ou chave privada. Isso viabiliza fluxos de trabalho que movem arquivos gerados para um destino remoto, puxam arquivos de um servidor para processamento, sincronizam o conteúdo de diretórios ou gerenciam estruturas de arquivos remotas como parte de uma automação maior.
Upload, download, list, and manage files on remote servers via SFTP. Supports both password and private key authentication for secure file transfers.
Upload files to a remote SFTP server
| Parameter | Type | Required | Description |
|---|
host | string | Yes | SFTP server hostname or IP address |
port | number | Yes | SFTP server port (default: 22) |
username | string | Yes | SFTP username |
password | string | No | Password for authentication (if not using private key) |
privateKey | string | No | Private key for authentication (OpenSSH format) |
passphrase | string | No | Passphrase for encrypted private key |
remotePath | string | Yes | Destination directory on the remote server |
files | file[] | No | Files to upload |
fileContent | string | No | Direct file content to upload (for text files) |
fileName | string | No | File name when using direct content |
overwrite | boolean | No | Whether to overwrite existing files (default: true) |
permissions | string | No | File permissions (e.g., 0644) |
| Parameter | Type | Description |
|---|
success | boolean | Whether the upload was successful |
uploadedFiles | json | Array of uploaded file details (name, remotePath, size) |
message | string | Operation status message |
Download a file from a remote SFTP server
| Parameter | Type | Required | Description |
|---|
host | string | Yes | SFTP server hostname or IP address |
port | number | Yes | SFTP server port (default: 22) |
username | string | Yes | SFTP username |
password | string | No | Password for authentication (if not using private key) |
privateKey | string | No | Private key for authentication (OpenSSH format) |
passphrase | string | No | Passphrase for encrypted private key |
remotePath | string | Yes | Path to the file on the remote server |
encoding | string | No | Output encoding: utf-8 for text, base64 for binary (default: utf-8) |
| Parameter | Type | Description |
|---|
success | boolean | Whether the download was successful |
file | file | Downloaded file stored in execution files |
fileName | string | Name of the downloaded file |
content | string | File content (text or base64 encoded) |
size | number | File size in bytes |
encoding | string | Content encoding (utf-8 or base64) |
message | string | Operation status message |
List files and directories on a remote SFTP server
| Parameter | Type | Required | Description |
|---|
host | string | Yes | SFTP server hostname or IP address |
port | number | Yes | SFTP server port (default: 22) |
username | string | Yes | SFTP username |
password | string | No | Password for authentication (if not using private key) |
privateKey | string | No | Private key for authentication (OpenSSH format) |
passphrase | string | No | Passphrase for encrypted private key |
remotePath | string | Yes | Directory path on the remote server |
detailed | boolean | No | Include detailed file information (size, permissions, modified date) |
| Parameter | Type | Description |
|---|
success | boolean | Whether the operation was successful |
path | string | Directory path that was listed |
entries | json | Array of directory entries with name, type, size, permissions, modifiedAt |
count | number | Number of entries in the directory |
message | string | Operation status message |
Delete a file or directory on a remote SFTP server
| Parameter | Type | Required | Description |
|---|
host | string | Yes | SFTP server hostname or IP address |
port | number | Yes | SFTP server port (default: 22) |
username | string | Yes | SFTP username |
password | string | No | Password for authentication (if not using private key) |
privateKey | string | No | Private key for authentication (OpenSSH format) |
passphrase | string | No | Passphrase for encrypted private key |
remotePath | string | Yes | Path to the file or directory to delete |
recursive | boolean | No | Delete directories recursively |
| Parameter | Type | Description |
|---|
success | boolean | Whether the deletion was successful |
deletedPath | string | Path that was deleted |
message | string | Operation status message |
Create a directory on a remote SFTP server
| Parameter | Type | Required | Description |
|---|
host | string | Yes | SFTP server hostname or IP address |
port | number | Yes | SFTP server port (default: 22) |
username | string | Yes | SFTP username |
password | string | No | Password for authentication (if not using private key) |
privateKey | string | No | Private key for authentication (OpenSSH format) |
passphrase | string | No | Passphrase for encrypted private key |
remotePath | string | Yes | Path for the new directory |
recursive | boolean | No | Create parent directories if they do not exist |
| Parameter | Type | Description |
|---|
success | boolean | Whether the directory was created successfully |
createdPath | string | Path of the created directory |
message | string | Operation status message |