Rename Activity
The Rename activity enables users to change the name of an existing file or folder within a specified directory. This activity facilitates file system management by providing options to handle naming conflicts.
| Field | Description | Requirement |
|---|---|---|
| File Name | The full path and name of the file or folder to be renamed. | Required |
| New File Name | The new name for the file or folder, without the path. The file extension can also be changed. | Required |
| Overwrite | Specifies whether to overwrite an existing file or folder with the same new name. | Optional |
Action Types & Examples
File Name
- Format:
[string] - Example Result:
"C:TempTest.xlsx"
New File Name
- Format:
[string] - Example Result:
"newFile.xlsx"
Overwrite
- Format:
[boolean] - Example Result:
true
Implementation Examples
Field Setup - File Name: C:TempTest.xlsx - New File Name: newFile.xlsx - Overwrite: true
Execution Parameters - To rename a file: - File Name: C:TempTest.xlsx - New File Name: newFile.xlsx - To rename a folder: - File Name: C:TempTest - New File Name: NewFolder - To change a file's extension during rename: - File Name: C:test.txt - New File Name: test.csv - To allow overwriting an existing target: - Overwrite: true - To prevent overwriting an existing target: - Overwrite: false
Technical Notes
The
New File Nameparameter allows for simultaneous renaming and file extension changes. For example,C:test.txtcan be renamed totest.csv.The behavior of the
Overwriteparameter is as follows: - IfOverwriteistrue: The activity renames the file or folder. If a file or folder with theNew File Namealready exists in the target directory, it will be overwritten. - IfOverwriteisfalse: The activity renames the file or folder if no existing file or folder has theNew File Name. If a file or folder with theNew File Namealready exists, the activity will not perform the rename operation and will generate an error with the message "There is folder already in the directory."