Actions15
Overview
This node provides file and folder management operations on the local disk. It supports a variety of common filesystem tasks such as compressing files or folders into archives, copying, moving, renaming, creating, deleting, reading, writing, appending to files, changing permissions, listing directory contents, checking existence, retrieving metadata, extracting archives, and searching for files matching patterns.
The Compress operation specifically creates a compressed archive (tar.gz) from a specified source file or folder and saves it to a target destination path. This is useful for packaging files or directories for backup, transfer, or storage in a compressed format.
Practical examples:
- Compressing a project folder before uploading it to cloud storage.
- Archiving log files daily into compressed archives to save space.
- Packaging multiple files into one compressed archive for easier distribution.
Properties
| Name | Meaning |
|---|---|
| Source Path | Path of the source file or folder to be compressed. |
| Destination Path | Target path where the compressed archive (tar.gz) will be saved. |
Output
The output JSON contains the following fields after successful compression:
operation: The string"compress"indicating the performed operation.success: Booleantrueindicating the operation succeeded.sourcePath: The original source path that was compressed.destinationPath: The path where the compressed archive was created.
No binary data is output by this node; it only returns metadata about the operation.
Dependencies
- Requires access to the local filesystem with appropriate read/write permissions.
- Uses the system's
tarcommand-line utility to perform compression (tar -czf). - Node.js built-in modules:
fs(filesystem),path,child_process(to spawntar), andzlib.
No external API keys or credentials are needed.
Troubleshooting
Common issues:
- The
tarcommand may not be available or accessible on the system PATH, causing the compression to fail. - Insufficient filesystem permissions to read the source or write to the destination path.
- Specifying invalid or non-existent source paths.
- Destination path pointing to a location without write permission.
- The
Error messages:
tar exited with code X: Indicates thetarprocess failed with exit codeX. Check if the source path exists and is accessible, and verify the destination path is writable.- Filesystem errors like "ENOENT" (no such file or directory) or "EACCES" (permission denied) can occur if paths are incorrect or permissions insufficient.
Resolutions:
- Ensure the
tarutility is installed and available in the environment where n8n runs. - Verify all paths exist and have correct permissions.
- Use absolute paths to avoid ambiguity.
- Run n8n with sufficient privileges to access the required files and folders.
- Ensure the