Move File

Move or rename files and directories

Overview

This node moves or renames files and directories on the filesystem. It is useful in automation workflows where files need to be reorganized, renamed, or relocated as part of a process, such as moving processed files to an archive folder, renaming files after processing, or organizing files into different directories based on workflow logic.

Practical examples:

  • Moving a log file from a temporary directory to a permanent storage location.
  • Renaming and moving image files after resizing or watermarking.
  • Organizing output files into date-based folders automatically.
  • Safely moving directories containing multiple files with optional backup creation.

The node supports moving both files and directories, with options to control overwrite behavior, directory creation, fallback strategies, and backups.

Properties

Name Meaning
Source Path The path of the file or directory to move.
Destination Path The destination path for the moved file or directory.
Move Options Collection of options controlling the move operation:
- Overwrite Existing Whether to overwrite existing files at the destination if they already exist (true or false).
- Create Destination Directory Whether to create the destination directory if it does not exist (true or false).
- Move Mode What type of item to move:
• File Only — move only if source is a file
• Directory Only — move only if source is a directory
• Auto Detect — automatically detect and move file or directory (default)
- Fallback to Copy+Delete Whether to fallback to copying the source to destination and then deleting the source if an atomic move fails (e.g., across different filesystems) (true or false).
- Backup Original Whether to create a backup of the original file or directory before moving it (true or false).
- Backup Directory Directory to store backups if backup is enabled. If empty, a temporary directory is used.

Output

The node outputs JSON data for each input item describing the result of the move operation:

  • success (boolean): Indicates if the move was successful.
  • moved (boolean): True if the file/directory was moved.
  • sourcePath (string): Resolved absolute path of the source.
  • destinationPath (string): Resolved absolute path of the destination.
  • sourceType (string): Either "file" or "directory".
  • sourceName (string): Base name of the source file or directory.
  • destinationName (string): Base name of the destination file or directory.
  • size (number): Size in bytes of the moved file or directory info.
  • sizeHuman (string): Human-readable size string (e.g., "1.23 MB").
  • moveTime (number): Time taken in milliseconds for the move operation.
  • moveMethod (string): Method used for moving, either "atomic" (rename) or "copy-delete" (fallback).
  • movedAt (string): ISO timestamp when the move completed.
  • overwriteMode (boolean): Whether overwriting was enabled.
  • isRename (boolean): True if the move was effectively a rename within the same directory.
  • backupPath (string, optional): Path to the backup created if backup option was enabled.

If the move fails and "Continue On Fail" is enabled, the output will contain:

  • success: false
  • moved: false
  • error: error message describing the failure
  • sourcePath and destinationPath as provided

The node does not output binary data.

Dependencies

  • Requires access to the local filesystem with appropriate read/write permissions.
  • Uses Node.js built-in modules: fs (filesystem), path.
  • No external API or service dependencies.
  • No special environment variables required beyond standard filesystem access.

Troubleshooting

Common Issues

  • Source path does not exist: The node throws an error if the source file or directory cannot be found.
  • Destination exists and overwrite disabled: If the destination path exists and overwrite is set to false, the node errors out.
  • Move mode mismatch: If the move mode is set to "File Only" but the source is a directory (or vice versa), an error is thrown.
  • Permission denied: Insufficient permissions to read the source or write to the destination will cause failures.
  • Cross-filesystem move failure: Atomic rename may fail if source and destination are on different filesystems; fallback copy+delete can handle this if enabled.
  • Backup directory issues: If backup is enabled but the backup directory is invalid or inaccessible, backup creation may fail.

Error Messages and Resolution

  • "Source path is required": Provide a valid source path.
  • "Destination path is required": Provide a valid destination path.
  • "Source path not found: ...": Verify the source path exists and is accessible.
  • "Source is not a file (move mode is 'file'): ..." or "Source is not a directory (move mode is 'directory'): ...": Adjust the move mode or ensure the source matches the expected type.
  • "Destination already exists and overwrite is disabled: ...": Enable overwrite or choose a different destination path.
  • "Move failed and fallback is disabled: ...": Enable fallback copy+delete or ensure source and destination are on the same filesystem.
  • Permission errors: Check user permissions for source and destination paths.

Enabling "Continue On Fail" allows the workflow to continue processing other items even if some moves fail.

Links and References

Discussion