Delete duplicate files by comparing two folders

I have folder 1 and folder 2 which have repeated files in both folders. How can I compare the two folders and generate a Folder 3 with the complete files without the files that are repeated in the folders?

Hi @Sebasthian_Arias ,

You can use Directory.GetFiles for this task.

  1. Get all files from folder 1 using Directory.GetFiles(folderPath1) and store it in array of strings ex : variable1.
    Similarly do this for folderPath2 and store in variable 2.
  2. Use two for each activity to iterate between array of string variable1 and variable2.
  3. Use assign activity to store each filename with System.IO.Path.GetFileName(path) for two array variables inside each for each activity.
  4. Use if condition to check whether file name is same or not. If yes, use copy file activity to move it to folderpath 3.

Let me know in case of any queries.

Here you go with a xaml
hope its resolved
splitt.zip (10.0 KB)

Cheers @Sebasthian_Arias

Folder 3 must contain only files that are not in folder 1, it is as if folder 2 is the base and is compared to folder1 to get the folder 3.

1 Like

fine
kindly check with this
splitt.zip (10.1 KB)

Cheers @Sebasthian_Arias

The file exists in folder 1

The file has to be deleted and not printed in folder 3

The file in Folder 3 "7703670900009_7431544.TXT "

I forgot to mention it

Someone who can help me with this issue I thank you.

The script contributed by @Palaniyappan works, but the following happens:

You must do the following:
As soon as folder 2 verifies that there are equal files in folder 1, it deletes and pass the remaining files them and generat the folder 3.

but this is not doing…

Hello Sebastian,
In this video I do a lot of stuff with Files:
For you is important to see minute 9 how I use the function EXCEPT

1:10 Download the file and Move the latest file to folders
4:30 Rename files with VB commands
6:00 Move files to do Rename
6:55 Delete files
8:15 Delete only PNG files
8:55 Delete all the files except PNG files
9:55 Move files
11:10 Delete files that are older than 2 weeks
14:40 Create a file or folder with dates inside
17:00 Trigger a process when the file is added to a folder
18:45 How to use the files start the process
20:30 Excel Application Scope use files

Thanks,
Cristian Negulescu

Thanks all for nice discussion here about duplicate files. Try to use Duplicate Files Deleter to find and delete duplicates files, photos, downloads etc. This is useful and works great. Thanks