Skip to main content

Delete Directory

Allows removal of a directory from an FTP server.

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

if ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.

Input

  • Session Id - The ID of the FTP session. The ID is the output of the Connect node.
  • Ftp Directory Path: The path to the FTP directory you wish to remove.

How It Works

The Delete Directory node removes a directory from the remote FTP server:

  1. Session Validation: Verifies the session ID is valid and active
  2. Path Validation: Ensures the directory path is not empty
  3. Directory Deletion: Removes the directory at the specified path
  4. Recursive Removal: For FTP, removes the directory and all its contents recursively

Requirements

  • Active FTP session from the Connect node
  • Valid directory path on the FTP server
  • Delete permissions on the directory
  • For FTPS and SFTP: Directory must be empty (non-recursive deletion)
  • For FTP: Directory can contain files (recursive deletion supported)

Error Handling

Error CodeDescriptionCause
Core.FTP.RemoveDir.ErrOnCreateConfig parse errorNode configuration is malformed
Core.FTP.RemoveDir.ErrOnMessageMessage parse errorInput message cannot be parsed
Core.FTP.RemoveDir.ErrSessionSession id can not be emptySession ID input is empty
Core.FTP.RemoveDir.ErrSessionInvalid sessionSession ID does not exist or has expired
Core.FTP.RemoveDir.ErrPathPath can not be emptyDirectory path input is empty
Core.FTP.RemoveDir.ErrorDirectory removal errorFailed to delete directory (details in error message)

Usage Examples

Example 1: Delete an Empty Directory

// Input:
// Session ID: "ftp-session-123"
// FTP Directory Path: "/temp/old-folder"
//
// Removes the directory from the server

Example 2: Cleanup After Processing

// Workflow:
// 1. Download all files from "/processing/batch-001"
// 2. Process files locally
// 3. Delete directory "/processing/batch-001"
//
// This ensures temporary directories are cleaned up

Example 3: Delete Directory with Error Handling

// Use Continue On Error to handle cases where directory doesn't exist
// Or wrap in Try-Catch to handle deletion failures gracefully
// Session ID: "ftp-session-123"
// FTP Directory Path: "/archives/2023"

Usage Notes

  • For FTP connections: Directory is deleted recursively with all contents (files and subdirectories)
  • For FTPS/SFTP connections: Directory must be empty before deletion
  • If the directory contains files in FTPS/SFTP, delete files first using Delete File node
  • Use forward slashes (/) in paths regardless of server OS
  • The operation is permanent and cannot be undone
  • Some FTP servers may restrict deletion of certain directories
  • Root directory and system directories typically cannot be deleted

Tips

  • Always verify the directory path before deletion to avoid accidental data loss
  • Use List Directory first to check directory contents
  • For FTPS/SFTP, create a loop to delete all files before deleting the directory
  • Use Continue On Error if the directory might not exist
  • Combine with conditional logic to only delete directories meeting certain criteria
  • Keep logs of deleted directories for audit purposes
  • Test deletion operations with non-critical directories first
  • Be aware of FTP server quota calculations after deletion