Remove FTP directory
Description
Removes an empty directory from an FTP/SFTP server. Takes an FTP file object from Find/Get FTP files or Create FTP directory — the server connection comes from the object itself. The directory is checked and must be empty: this node never deletes a tree, so clear the entries first with Find FTP files and Remove FTP file. Branches on success/error; the error branch is also taken when the directory is not empty or does not exist.
When to use
Use Remove FTP directory to clean up a directory a pipeline no longer needs — a scratch folder, a staging area, a dated batch directory whose contents have been processed and removed. Remove FTP file only ever deletes files, so this is the node that takes a directory off the server.
Like Open, Remove, and Move FTP file, it takes an FTP file object rather
than credentials and a path: the directory has to exist to be removed, so
there is something to wire in. Find FTP files with Type set to DIRECTORY
is the usual source; Create FTP directory’s own output works too.
The directory must be empty, and the node checks that itself rather than leaving it to the server. Most FTP servers refuse to remove a directory that still has entries, but not all do — some delete the whole tree — and that is far too destructive a difference to depend on. A directory with anything in it takes the Error pin on every server alike. To remove a directory and its contents, list the entries with Find FTP files, delete them with Remove FTP file, and then remove the directory: the deletion stays visible in the pipeline rather than hidden inside one node.
Pins
Input pins
| Pin | Type | Default | Notes |
|---|---|---|---|
| Directory | FTP file | — | The directory to remove, from Find FTP files, Get FTP file, or Create FTP directory. It carries its own server connection, so no credentials input is needed. |
Execution pins
| Pin | Direction |
|---|---|
| In | Input |
| Success | Output |
| Error | Output |
Example
Clean up after a batch. Wire FTP username/password credentials into Find
FTP files with Path /staging/batch-42 to list what is there, loop the
results into Remove FTP file, then pass the directory itself — from a Get
FTP file on /staging/batch-42 — into Remove FTP directory once the loop
completes.
Wire the Error pin to a Log message: it fires both when something is still in the directory (a file the loop failed to remove) and when the directory is already gone, and either is worth seeing in the execution log.