I have a folder with hundreds of files. Some files have the same name but a different file extension. These files contain the same information and therefore I consider them duplicates. However, due to the different extension, they can coexist in the folder because the system does not consider them duplicates.
I want to find a way to scan through the folder and delete the redundant instances, and only maintain one file for each file name. I don’t have a preference on the format, I just want to keep only one of them.
My approach was to use a For Each file, then get the file name without the extension, and then inside that For loop use an If statement, where the condition is:
Directory.GetFiles(FolderPath, “FileName.*”).Length > 1
And if that is true, then delete the current file.
Clearly, that is not correct, as I am not getting the desired result. Any ideas?