SFTP

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.

Usage Instructions

Upload, download, list, and manage files on remote servers via SFTP. Supports both password and private key authentication for secure file transfers.

Actions

sftp_upload

Upload files to a remote SFTP server

Input

ParameterTypeRequiredDescription
hoststringYesSFTP server hostname or IP address
portnumberYesSFTP server port (default: 22)
usernamestringYesSFTP username
passwordstringNoPassword for authentication (if not using private key)
privateKeystringNoPrivate key for authentication (OpenSSH format)
passphrasestringNoPassphrase for encrypted private key
remotePathstringYesDestination directory on the remote server
filesfile[]NoFiles to upload
fileContentstringNoDirect file content to upload (for text files)
fileNamestringNoFile name when using direct content
overwritebooleanNoWhether to overwrite existing files (default: true)
permissionsstringNoFile permissions (e.g., 0644)

Output

ParameterTypeDescription
successbooleanWhether the upload was successful
uploadedFilesjsonArray of uploaded file details (name, remotePath, size)
messagestringOperation status message

sftp_download

Download a file from a remote SFTP server

Input

ParameterTypeRequiredDescription
hoststringYesSFTP server hostname or IP address
portnumberYesSFTP server port (default: 22)
usernamestringYesSFTP username
passwordstringNoPassword for authentication (if not using private key)
privateKeystringNoPrivate key for authentication (OpenSSH format)
passphrasestringNoPassphrase for encrypted private key
remotePathstringYesPath to the file on the remote server
encodingstringNoOutput encoding: utf-8 for text, base64 for binary (default: utf-8)

Output

ParameterTypeDescription
successbooleanWhether the download was successful
filefileDownloaded file stored in execution files
fileNamestringName of the downloaded file
contentstringFile content (text or base64 encoded)
sizenumberFile size in bytes
encodingstringContent encoding (utf-8 or base64)
messagestringOperation status message

sftp_list

List files and directories on a remote SFTP server

Input

ParameterTypeRequiredDescription
hoststringYesSFTP server hostname or IP address
portnumberYesSFTP server port (default: 22)
usernamestringYesSFTP username
passwordstringNoPassword for authentication (if not using private key)
privateKeystringNoPrivate key for authentication (OpenSSH format)
passphrasestringNoPassphrase for encrypted private key
remotePathstringYesDirectory path on the remote server
detailedbooleanNoInclude detailed file information (size, permissions, modified date)

Output

ParameterTypeDescription
successbooleanWhether the operation was successful
pathstringDirectory path that was listed
entriesjsonArray of directory entries with name, type, size, permissions, modifiedAt
countnumberNumber of entries in the directory
messagestringOperation status message

sftp_delete

Delete a file or directory on a remote SFTP server

Input

ParameterTypeRequiredDescription
hoststringYesSFTP server hostname or IP address
portnumberYesSFTP server port (default: 22)
usernamestringYesSFTP username
passwordstringNoPassword for authentication (if not using private key)
privateKeystringNoPrivate key for authentication (OpenSSH format)
passphrasestringNoPassphrase for encrypted private key
remotePathstringYesPath to the file or directory to delete
recursivebooleanNoDelete directories recursively

Output

ParameterTypeDescription
successbooleanWhether the deletion was successful
deletedPathstringPath that was deleted
messagestringOperation status message

sftp_mkdir

Create a directory on a remote SFTP server

Input

ParameterTypeRequiredDescription
hoststringYesSFTP server hostname or IP address
portnumberYesSFTP server port (default: 22)
usernamestringYesSFTP username
passwordstringNoPassword for authentication (if not using private key)
privateKeystringNoPrivate key for authentication (OpenSSH format)
passphrasestringNoPassphrase for encrypted private key
remotePathstringYesPath for the new directory
recursivebooleanNoCreate parent directories if they do not exist

Output

ParameterTypeDescription
successbooleanWhether the directory was created successfully
createdPathstringPath of the created directory
messagestringOperation status message

On this page