How Move File activity should create duplicate file if file already exists?

Hi Team,

I have moved files from downloads folder to destination folder and I need to move that with new name like File(2) if same file name exists (For Ex: Filename1 is exists then it should create Filename1(2)) and should not override.

Tried with Move file but it should either will move or override but not creating duplicate file. Please suggest.

Thank you.

Hi @katakam26

Try to use copy file based on path exists

Thanks
Ashwin.S

Hi,

Use GetFiles Activity with like operator to get similar files with the same name, then using its count you can save the file with new name by increment the count.

Ex:
Already available in the folder
newfile.xlsx
newfile_1.xlsx

Now you will get 2 as the file count for get files with Newfile as the wildcard in that activity.
So your new file will be saved as “newfile_2.xlsx”

@katakam26

Use Copy File activity and Uncheck Overwrite option in properties.

2 Likes

Hi can you provide the xaml file for this,i want the same , my requirement is similar i want to move the same file again and again with incremented value.Please help Asap. Thankyou in advance.

This doesn’t work with Copy File or Move File as it throws an error saying “The file ‘filename.txt’ already exists.”