Skip to main content

Move File/Dir

Moves file/folder from source path to destination path.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

if ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.

Input

  • Source Path - The source path of the file/directory that will be moved. (e.g. C:\MyDocs\Example.xlsx)
  • Destination Path - The destination path of the file/directory will be moved. (e.g. C:\Archives\Example.xlsx)

How It Works

The Move File/Dir node relocates files or directories through the following process:

  1. Validates that both source and destination paths are not empty
  2. Checks if the source is a directory or a file
  3. For directories: Uses os.Rename to move the directory atomically
  4. For files: Uses a utility function (MoveFile) to move the file
  5. The source file/directory is removed after the move completes successfully

Requirements

  • Valid source path to an existing file or directory
  • Valid destination path
  • Write permissions on both source and destination locations
  • Destination path should not already exist (will be overwritten for files)
  • Source and destination should be on the same filesystem for atomic moves

Error Handling

Error CodeDescription
Core.FileSystem.Move.ErrOnCreateNode configuration parsing failed
Core.FileSystem.Move.OnMessageInput message parsing failed
Core.FileSystem.Move.ErrPathSource or destination path is empty
Core.FileSystem.Move.ErrMove operation failed (permission denied, destination exists, or cross-device move)

Usage Examples

Example 1: Move a File to Archive

Move a processed file to an archive directory:

{
"sourcePath": "C:\\Processing\\invoice_2024.pdf",
"destPath": "C:\\Archive\\invoice_2024.pdf"
}

This removes the file from Processing and places it in Archive.

Example 2: Rename a File

Rename a file by moving it within the same directory:

{
"sourcePath": "D:\\Reports\\draft_report.xlsx",
"destPath": "D:\\Reports\\final_report.xlsx"
}

Example 3: Move Directory

Move an entire directory to a new location:

{
"sourcePath": "C:\\Projects\\Completed\\Project_A",
"destPath": "D:\\Archive\\Projects\\Project_A"
}

All contents of the directory are moved together.

Usage Notes

  • Move is faster than Copy + Delete as it doesn't copy data, just updates file system metadata
  • For directories, os.Rename is used which is an atomic operation on the same filesystem
  • Moving across different drives/partitions may be slower as it requires copying data
  • The source file or directory is removed after a successful move
  • If the destination exists, the behavior depends on the underlying system (may overwrite or fail)
  • Network paths are supported but may be slower
  • Moving files is atomic on the same filesystem, preventing partial moves

Tips

  • Use Move instead of Copy + Delete for better performance and atomicity
  • Test move operations on non-critical data first
  • Use Path Exists to verify the source exists before moving
  • Combine with List Directory to batch move multiple files
  • For cross-drive moves, expect slower performance as data must be copied
  • Use timestamped destination paths to avoid overwriting existing files
  • Consider using Move for file renaming operations within the same directory
  • Enable Continue On Error when moving files that might not exist