Actions15
Overview
This node, named "File Manager," provides a variety of file and folder management operations on the local disk. It is useful for automating tasks such as renaming, moving, copying, compressing, extracting files or directories, and more within an n8n workflow.
The Rename operation specifically allows you to rename a file or folder by specifying its current path and the new desired path. This can be beneficial in scenarios where files need to be organized or renamed dynamically based on workflow data, such as renaming uploaded files, organizing logs, or preparing files for further processing.
Practical example:
- Rename a log file after processing it to archive it with a timestamp.
- Rename a temporary upload folder to a permanent location once validation is complete.
Properties
| Name | Meaning |
|---|---|
| Source Path | Path of the source file or folder to rename (current name/path). |
| Destination Path | Target path representing the new name or location for the file or folder after renaming. |
Output
The output JSON object contains the following fields after a successful rename operation:
operation: The string"rename"indicating the performed operation.success: A booleantrueindicating the operation succeeded.sourcePath: The original path of the file or folder before renaming.destinationPath: The new path of the file or folder after renaming.
No binary data is output by this operation.
Example output JSON:
{
"operation": "rename",
"success": true,
"sourcePath": "/path/to/oldname.txt",
"destinationPath": "/path/to/newname.txt"
}
Dependencies
- The node uses Node.js built-in modules:
fs(filesystem),path,child_process, andzlib. - No external services or API keys are required.
- The node operates on the local filesystem where n8n is running, so appropriate file system permissions are necessary.
- No special environment variables or n8n credentials are needed for the rename operation.
Troubleshooting
Common issues:
- Permission denied: The node may fail if the n8n process does not have sufficient permissions to access or modify the specified paths.
- Source path does not exist: If the source file or folder path is incorrect or missing, the operation will throw an error.
- Destination path already exists: Renaming to a destination path that already exists might cause errors depending on the OS behavior.
Error messages:
- Errors thrown by the underlying filesystem calls (e.g.,
ENOENTfor missing files,EACCESfor permission issues) will be surfaced. - The node wraps errors in a standard error format; check the error message for details.
- Errors thrown by the underlying filesystem calls (e.g.,
Resolution tips:
- Verify that the source path is correct and accessible.
- Ensure the destination path does not conflict with existing files unless overwriting is intended and supported.
- Run n8n with sufficient permissions to read/write the involved paths.
Links and References
- Node.js fs.promises.rename() documentation
- n8n Documentation - Creating Custom Nodes
- Unix/Linux File Permissions (relevant for troubleshooting permission issues)