Comparing two folders and copying only new files

Hi Team,

I want to compare two folders which is having .csv files.
If same files are there copy to one folder.(scenario 1)
If new files are there ,copy to another folder.(scenario 2)
Attached xaml works fine in scenario 1,but doesnt works in scenario 2 as its copying new files along with old files also.

Appreciate your help.
SearchMyDocuments_Testing.xaml (13.9 KB)

Hi @RajeshT

Please use below linq to get the difference from 2 array of strings.

- array2.Except(array1)
- array1.Except(array2)
- array1.Union(array2)

Mark as solution if found helpful :slight_smile:


Please find the below example (13.4 KB)


Mark as solution if found useful :slight_smile:

Hi Roshan,

You mean i need to take folder 1 as array1 and folder 2 as array 2?

@RajeshT, are we comparing folders by size?, or we comparing each file in one folder agains another file in a different folder? what is the criteria here?

Would it be correct if we get recent files from both folders and comparing those files against each other? if yes then are these pdf files or? and do we need to compare the data on the files or just the names?

1 Like

Hi @RajeshT

Yes . when you read the folder using directory.getfiles(“FOlder_Path”) then the return variable will be array of strings.


1 Like

Hi @unknownay,

I have done my workflow ,withyour inputs .
Thank you.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.