Move File
Move File
Section titled “Move File”Type: move-file · Package: Filesystem Activities v1.0.6 · Output: string
Moves a file from a source path to a destination. The original no longer exists in its previous location. As a special case, if source and destination are in the same folder with different names, it renames the file. Widely used to archive processed documents or reorganize downloaded files.
How it works
Section titled “How it works”Moves the file at source to destination.
- Destination:
destinationis the full path of the file (folder + name), not just the folder. - Folders: if the destination folder does not exist, it is created (with any intermediate ones).
- Overwriting: by default it does not overwrite: if the destination exists, it fails (unless
overwrite = true). - Across drives: within the same drive the move is instant; to another drive or a network folder, the file is copied and then the original is deleted.
- Files only: it does not move folders.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
source | string | — | Path of the source file. |
destination | string | — | Full destination path (or new name, in the same folder). |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
overwrite | bool | false | Replace the destination if it already exists. |
Output
Section titled “Output”Returns a string with the destination path of the moved file (as you gave it in destination).
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Could not find file '…'. | The source file does not exist (maybe it was already moved by an earlier attempt). Check it with File Exists. |
Cannot create a file when that file already exists. | The destination exists and overwrite is false. Set overwrite = true or add something unique to the name (date, id). |
The process cannot access the file '…' because it is being used by another process. | The file is open in another program. |
Access to the path '…' is denied. | No permission on the source or the destination folder. |
'source' is required. / 'destination' is required. | The parameter’s expression evaluated to null. |
Examples
Section titled “Examples”Archive after processing and log where it went:
Move File source = path destination = pathJoin("C:/processed", fileName(path)) → output: archivedLog message = "Archived at " + archivedRename:
Move File source = "C:/data/temp.csv" destination = "C:/data/customers_final.csv"Related activities
Section titled “Related activities”- Copy File — copy and keep the original.
- List Files — get the files to move.