Renaming a file in a folder when the name already exists

Hi all - I am looking for ideas on how to rename a file in a folder and overwrite when the file already exists? I see the overwrite option when you copy a file, but I do not see the option when you rename a file?

@audra.swope,

Use File Exists activity to check if file already exists in the folder.

If exist rename using Rename File activity.

Hi , @audra.swope

Assign newFilePath = “C:\YourFolder\newFileName.extension” Assign oldFilePath = "C:\YourFolder\oldFileName.extension"

1-If (File Exists)-
-Condition: File.Exists(newFilePath)
Then:
Use the Delete activity to delete the existing file: File.Delete(newFilePath)

  1. Move File Activity:
    From: oldFilePath
    To: newFilePath

Hi @audra.swope ,

You can use move file activity and check the overwrite option. you need to create folder path, file name logic. mentioned is the screenshot based on you can build your automation to rename files. please let me know if it works.

Hi, @audra.swope

Are you check it