Overview
This node performs various file system operations on files and directories. The "Clean Empty Directories" operation specifically removes empty directories from a specified path, optionally processing subdirectories recursively. This is useful for maintaining tidy directory structures by automatically deleting folders that no longer contain any files or subfolders.
Practical examples include:
- Cleaning up temporary or cache folders after file processing workflows.
- Removing empty folders left behind after moving or deleting files.
- Automating maintenance tasks in file management pipelines.
Properties
| Name | Meaning |
|---|---|
| Directory Path | The path of the directory where empty directories should be cleaned. |
| Recursive | Whether to process subdirectories recursively (true) or only the top-level directory (false). |
Output
The output JSON contains the original input data merged with a success field indicating whether the cleaning operation was successful (true). For each input item, the node returns an object like:
{
"...originalInputFields": "...",
"success": true
}
No binary data is produced by this operation.
Dependencies
- No external services or API keys are required.
- The node relies on local file system access permissions to read and delete directories.
- It uses internal helper functions to perform the directory cleaning asynchronously.
Troubleshooting
Common issues:
- Insufficient permissions to delete directories may cause errors.
- Specifying an incorrect or non-existent directory path will result in failure.
- If recursive is set to false, only the top-level directory is checked, so nested empty directories remain.
Error messages:
- Errors related to file system access (e.g., "Permission denied") indicate the node lacks rights to modify the target directory.
- "Directory not found" or similar indicates an invalid path parameter.
Resolutions:
- Ensure the node runs with appropriate file system permissions.
- Verify the directory path exists and is accessible.
- Use the recursive option if you want to clean empty directories at all levels.