FileOperate icon

FileOperate

File system operations for files and directories

Clean Empty Directories

AI-generated

Overview

This node operation cleans empty directories recursively within a specified directory path. It is useful for maintaining a tidy file system by removing directories that no longer contain any files or subdirectories. For example, after a batch file deletion or file move operation, this node can be used to clean up leftover empty folders automatically.

Use Case Examples

  1. Automatically clean up empty folders in a project directory after file operations.
  2. Maintain a clean directory structure by removing empty folders in backup or archive directories.

Properties

Name Meaning
Directory Path The path of the directory where empty directories will be cleaned recursively.
Recursive Whether to process subdirectories recursively to clean empty directories within them.

Output

JSON

  • success - Indicates whether the cleaning operation was successful.

Dependencies

  • Uses an internal utility function to perform the cleaning operation.

Troubleshooting

  • Ensure the specified directory path exists and is accessible by the node to avoid errors.
  • If the node fails, check permissions to delete directories in the specified path.
  • Common error messages relate to invalid directory paths or permission issues; verify the path and user permissions.

Discussion