Rename File
Renames one file by keeping its current parent folder and replacing only the leaf name with `newName`. If `overwrite` is false, the block fails when the target name already exists in the same folder. Use `pathChangeExtension` first when the new name should be derived from the existing file name.
Inputs
| Input | Required | Value Kind | Types | Enum Values |
|---|---|---|---|---|
path | yes | expression | string | — |
newName | yes | expression | string | — |
overwrite | no | expression | — | — |
Notes
- Filesystem read/write statement that keeps the current parent folder and replaces only the leaf name.
- Fails on existing targets unless
overwrite=true.
Examples
Rename File By Changing Extension
Builds a new leaf name from the original file name without extension, then renames the file inside its current parent folder.
Topics: files, path handling
Source: patterns/ex-files-rename-by-changing-extension.json