Checking duplicate files in folder

Hello experts

I want to check files in two folders and if the files name are the same, I will delete the files in the folder and if the files name are different, I will copy the files to another folder.
How to check the duplicate files in two folder? If the file names are the same, the file will be deleted and if the file names are different, the file will be copied to another folder.
I have the files in download folder like this:
image

I have the files in original folder like this:
image

Above the scanerio, I want to copy the files all the files except NTV_UAT_0001624.xlsx to original folder and delete the file name NTV_UAT_0001624.xlsx in download folder.
If you have solutions for this, please share with me.

Hi!

Try this below:

Assign FolderPath1 = "Desktop\FirstFolder\"

Where FolderPath1 is a string type variable

Assign FolderPath2 = "Desktop\SecondFolder\"

Where FolderPath2 is a string type variable

Assign Arr_Folder1 = Directory.GetFiles(Folderpath1,"*.xlxx")

Where Arr_Folder1 is a Array(string) type variable

Assign Arr_Folder2 = Directory.GetFiles(Folderpath2,"*.xlxx")

Where Arr_Folder2 is a Array(string) type variable

Take one For each activity and pass the Arr_Folder1
Take one more for each activity and pass the Arr_Folder2

Now take one if activity… Pass the condition like this

Item1.ToString.Trim.ToLower.Equals(item2.ToString.Trim.ToLower)

In then Block Use Delete file Activity

In else block keep Copy Excel File activity

That’s it

Try this and let me know

Regards,
NaNi

can u please share me the workflow file and at the first time, there is no file in original floder.
At the first time runs, does the condition also work?
And also if there is another solution to process as fast as possible, please also share with me.Thanks.

Hey!

Without having the files in a folder how can we compare the files with different folders?

If those duplicates files placed in a single folder we can’t compare because… The folder won’t accept the duplication…

Example:

File: Nani.xlsx
DuplicateFile: Nani-Copy.xlsx

The file will modify like this else file explorer asks us to replace or skip the existing file…

Could you please share us the snap of input folder path which is having files?

Regards,
NaNi

Hello @Zaw_Win_Htun1

It would be better if you can share the process which you are automating and the requirement here.
This comparison maybe redesigned if you can elaborate the exact flow