File Manager

Manage files and folders on disk

Overview

The node provides comprehensive file and folder management capabilities on the local disk. It supports a variety of operations such as extracting compressed archives, copying, moving, renaming files or folders, and more. This node is useful in automation workflows where file system manipulation is required, for example:

  • Extracting a .tar.gz archive to a specified directory.
  • Copying files or entire directories from one location to another.
  • Moving or renaming files as part of an automated deployment or backup process.

Specifically, the Extract operation decompresses a gzip-compressed tar archive (.tar.gz) from a source path into a target destination folder, creating the destination folder if it does not exist.

Properties

Name Meaning
Source Path Path of the source file or folder. For extract, this should be the path to the archive file (e.g., .tar.gz).
Destination Path Target path where the extracted contents will be placed. Required for extract operation.

Output

The output JSON object for the Extract operation includes:

  • operation: The string "extract".
  • success: A boolean indicating whether the extraction succeeded (true).
  • sourcePath: The original source archive file path.
  • destinationPath: The directory path where the archive was extracted.

No binary data is output by this operation; the node only reports metadata about the performed extraction.

Dependencies

  • Requires access to the local filesystem with appropriate read/write permissions.
  • Uses the system's tar command-line utility to perform compression and extraction.
  • Node.js built-in modules: fs (filesystem), path, child_process (to spawn tar), and zlib (for gzip decompression).

No external API keys or credentials are needed.

Troubleshooting

  • Common issues:

    • Missing or incorrect sourcePath or destinationPath can cause errors.
    • Lack of filesystem permissions to read the source archive or write to the destination folder.
    • Absence of the tar utility on the host system will cause the extraction to fail.
    • Corrupted or unsupported archive format may lead to extraction errors.
  • Error messages:

    • tar exited with code X: Indicates that the tar command failed. Check the archive integrity and paths.
    • Filesystem permission errors: Ensure the n8n process has sufficient rights to access the specified paths.
  • Resolution tips:

    • Verify paths are correct and accessible.
    • Confirm tar is installed and available in the system PATH.
    • Check that the archive is a valid gzip-compressed tar file.
    • Run n8n with user privileges that allow file operations on the target directories.

Links and References

Discussion