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:
- Session Validation: Verifies the session ID is valid and active
- Path Validation: Ensures the directory path is not empty
- Directory Deletion: Removes the directory at the specified path
- 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 Code | Description | Cause |
|---|---|---|
| Core.FTP.RemoveDir.ErrOnCreate | Config parse error | Node configuration is malformed |
| Core.FTP.RemoveDir.ErrOnMessage | Message parse error | Input message cannot be parsed |
| Core.FTP.RemoveDir.ErrSession | Session id can not be empty | Session ID input is empty |
| Core.FTP.RemoveDir.ErrSession | Invalid session | Session ID does not exist or has expired |
| Core.FTP.RemoveDir.ErrPath | Path can not be empty | Directory path input is empty |
| Core.FTP.RemoveDir.Error | Directory removal error | Failed 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
Related Nodes
- Connect - Establish FTP connection
- Delete File - Delete files from directory first
- List Directory - Check directory contents before deletion
- Create Directory - Create a new directory
- File Exists - Verify directory existence
- Disconnect - Close the FTP session