Hi PRA,
Refer the below code. From the below code you will get all the files from your system as a list. Now you need to apply your logic to find duplicate files using for loop.
string file = string.Empty;
List<string> files = new List<string>();
string[] directoryForSearch = new string[] { "C", "D", "E" };
for (int k = 0; k < directoryForSearch.Length; k++)
{
DirectoryInfo drive = new DirectoryInfo(directoryForSearch[k] + ":\\");
DirectoryInfo[] folders = drive.GetDirectories("*.*");
for (int i = 0; i < folders.Length; i++)
{
FileInfo[] allFiles = folders[i].GetFiles("*.*");
if (allFiles.Length > 0)
{
for (int j = 0; j < allFiles.Length; j++)
{
files.Add(allFiles[j].DirectoryName + "\\" + allFiles[j].ToString());
}
}
}
}