Comparing file names


I have a folder of 1000 files and some of them belong to each other, which means that their name starts similarly such as:
20170821.pdf; 20170821_02.pdf, 20170821_03.pdf, 20170820.pdf, 20170820_02.pdf etc.

I am able to get the name of the latest file with File = new DirectoryInfo(myPath).GetFileSystemInfos().OrderByDescending(function(fi) fi.CreationTime).First()

but I need to do a comparison with the next file if it has the same name in the beginning. Can you please help me?

Hey @mario

Please check out below thread. I think it will fulfill your needs.


1 Like

Hi Aksh1

Is there a way we can find if there are files with same name but different types in a folder ?

for example …


Yes, there is and in fach it is very easy.

I share you and example Search_Files.xaml (12.0 KB)

My path contains all these files, and as you will see the result in the message box is 2 because in the arrays the items start in 0 (It is said, there are 3 elements that contains the name “Archivo” without taking into account the extension ).


I hope this example help you to solve your task

1 Like