Move Files
AI-generatedOverview
This node operation moves files and/or subdirectories from a specified source directory to a target directory. It supports filtering files and directories by a regular expression pattern, recursive processing of subdirectories, and selective inclusion of files or subdirectories. It also offers an option to rename the source files/directories without processing their contents and a stage test mode to simulate the operation without making actual changes. This operation is useful for organizing files, migrating data between folders, or restructuring directory contents.
Use Case Examples
- Moving all files from a source folder to a target folder while preserving directory structure.
- Moving only files that match a specific pattern (e.g., all .txt files) from one directory to another.
- Renaming files or directories in the source folder without moving their contents, useful for batch renaming tasks.
Properties
| Name | Meaning |
|---|---|
| Source Directory | The directory path from which files and/or subdirectories will be moved. |
| Target Directory | The directory path to which files and/or subdirectories will be moved. |
| Pattern | A regular expression pattern to filter which files or directories to move. Only items matching this pattern will be processed. |
| Recursive | Whether to process subdirectories recursively within the source directory. |
| Include Types | Specifies whether to include files, subdirectories, or both in the move operation. |
| Rename Only | If true, only rename the source file or directory without moving its contents. |
| Stage Test | Simulate the move operation without actually performing it, useful for testing and validation. |
Output
JSON
result- Result object containing details about the move operation, such as success status and any relevant metadata.
Dependencies
- This operation depends on an internal moveFiles function that handles the file system operations.
Troubleshooting
- Ensure the source and target directories exist and have appropriate permissions to read and write files.
- If using a pattern, verify the regular expression syntax is correct to avoid unexpected filtering results.
- When 'Rename Only' is enabled, the contents of directories are not moved, only the names are changed, which might not be the intended behavior.
- If 'Stage Test' is enabled, no actual file movement occurs; disable it to perform real operations.