File Manager

Manage files and folders on disk

Overview

This node, named "File Manager," provides a versatile interface to manage files and folders on disk within an n8n workflow. It supports multiple file system operations such as removing, copying, moving, compressing, extracting, creating, renaming, reading, writing, appending, changing permissions, listing contents, checking existence, retrieving metadata, and searching files or directories.

The "Remove" operation specifically deletes a file or folder at a given path. If the target is a folder, it can delete recursively based on user input. This operation is useful for cleaning up temporary files, automating file maintenance tasks, or managing storage by deleting unwanted data programmatically.

Practical examples:

  • Automatically remove log files older than a certain date.
  • Delete temporary export folders after processing.
  • Clean up uploaded files after successful import.

Properties

Name Meaning
Source Path Path of the source file or folder to be removed.
Recursive Whether to delete folders recursively (only applicable if the source path is a folder).

Output

The output JSON object includes:

  • operation: The name of the performed operation, here always "remove".
  • success: A boolean indicating whether the removal succeeded (true).
  • sourcePath: The path of the file or folder that was removed.

No binary data is output by this operation.

Example output JSON:

{
  "operation": "remove",
  "success": true,
  "sourcePath": "/path/to/source"
}

Dependencies

  • Requires access to the local filesystem where the n8n instance runs.
  • Uses Node.js built-in fs module with promises API for file operations.
  • No external APIs or credentials are required.

Troubleshooting

  • Common issues:

    • Attempting to remove a non-existent file or folder will cause an error.
    • Insufficient permissions to delete the specified path will result in failure.
    • Trying to remove a non-empty directory without enabling recursive deletion will throw an error.
  • Error messages and resolutions:

    • ENOENT (No such file or directory): Verify the Source Path is correct and accessible.
    • EACCES or EPERM (Permission denied): Ensure the n8n process has sufficient rights to delete the target.
    • ENOTEMPTY (Directory not empty): Enable the Recursive option to delete folders with contents.
  • To continue workflow execution despite errors, enable the node's "Continue On Fail" option.

Links and References

Discussion