Overview
The node performs various file system operations on files and directories. It supports cleaning empty directories, fixing incompatible file names, deleting files/directories, moving files/directories, flattening directory structures, and renaming files or directories.
For the Move Files operation specifically, it moves files and/or subdirectories from a source directory to a target directory. It can filter which items to move using a regular expression pattern, process directories recursively, and optionally only rename items without moving their contents. A "stage test" mode allows simulating the operation without making actual changes.
This node is useful for automating file management tasks such as reorganizing files, archiving data, cleaning up directory structures, or preparing files for further processing.
Practical examples:
- Moving all
.txtfiles from one folder to another while preserving subdirectory structure. - Renaming directories without moving their contents.
- Simulating a move operation to verify which files would be affected before executing.
Properties
| Name | Meaning |
|---|---|
| Source Directory | The path of the directory containing files and subdirectories to move. |
| Target Directory | The destination directory where files and subdirectories will be moved. |
| Pattern | Optional regular expression pattern to match specific files or directories to include in move. |
| Recursive | Whether to process subdirectories recursively (true/false). |
| Include Types | Select which types of items to include: files, subdirectories, or both. |
| Rename Only | If true, only rename the source file/directory without moving its contents. |
| Stage Test | If true, simulate the move operation without actually performing it (dry run). |
Output
The output JSON contains the original input data merged with a result field that summarizes the outcome of the move operation. This typically includes details about which files or directories were moved or renamed.
Example output snippet:
{
"sourceDir": "/path/source",
"targetDir": "/path/target",
"result": {
"movedFiles": [...],
"movedDirectories": [...],
"renamedOnly": true,
"simulated": true
}
}
The exact structure inside result depends on the underlying move function but generally reports success and lists affected items.
No binary data output is produced by this operation.
Dependencies
- The node relies on internal helper functions for file system operations bundled within the node's codebase.
- No external API keys or services are required.
- Requires appropriate file system permissions for reading from the source and writing to the target directories.
- Runs in environments where Node.js has access to the local file system.
Troubleshooting
Common issues:
- Insufficient permissions to read/write directories may cause errors.
- Invalid or inaccessible source or target directory paths.
- Incorrect regular expression patterns causing no files to match.
- Attempting to move files into the same directory or circular references.
Error messages:
- Errors related to file system access (e.g., "ENOENT", "EACCES") indicate permission or path issues.
- Pattern syntax errors if the regex pattern is invalid.
- If the node throws an error during execution, enabling "Continue On Fail" can help process remaining items.
Resolutions:
- Verify directory paths exist and are accessible.
- Test regex patterns separately to ensure correctness.
- Use "Stage Test" mode to preview changes before applying them.
- Ensure the node runs with sufficient privileges.