Skip to content

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 Name parameter allows for simultaneous renaming and file extension changes. For example, C:test.txt can be renamed to test.csv.

The behavior of the Overwrite parameter is as follows: - If Overwrite is true: The activity renames the file or folder. If a file or folder with the New File Name already exists in the target directory, it will be overwritten. - If Overwrite is false: The activity renames the file or folder if no existing file or folder has the New File Name. If a file or folder with the New File Name already exists, the activity will not perform the rename operation and will generate an error with the message "There is folder already in the directory."