Rename File

Overview

The Rename File Component allows users to rename or move a file within an FTP or SFTP server by providing the original path and a new path.

Usage

This component connects to an FTP/SFTP server and renames a file or moves it to a different directory.

Properties

Property
Type
Description

path

string

The current file path.

newPath

string

The new path or name for the file.

Input Ports

Port
Description

in

Accepts the original file path and the new file path for renaming or moving.

Output Ports

Port
Description

out

Emits success confirmation when the file is renamed or moved.

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 Rename or Move File:

    • Renames the file if the new path is in the same directory.

    • Moves the file if the new path specifies a different directory.

    • 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 original file path.

newPath

string

The new file path after renaming or moving.

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.

  • File Management: Enables renaming or moving files within the remote server structure.

This component is essential for workflows that require automated file renaming or relocation on remote servers.

Last updated