You could start with something like this:
string searchFile = "searchThisFile.txt";
string searchFilePath = "";
bool found;
System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();
foreach (System.IO.DriveInfo drive in drives)
{
if (drive.DriveType == System.IO.DriveType.Removable)
{
if (drive.IsReady)
{
string[] files = System.IO.Directory.GetFiles(drive.Name);
foreach(string file in files)
{
if (System.IO.Path.GetFileName(file) == searchFile)
{
searchFilePath = file;
found = true;
break;
}
}
}
if(found)
{
break;
}
}
}
if(found)
{
}
The code right here gets all removeable drives (USB sticks etc.) and searches for the file you want to process (searchFile). If it finds it it stops searching and store the found path inside searchFilePath.
Found will be set to true, this because otherwise it would still be searching all other drives which you don't want.
Hope this helped,
Good luck
Jordy "Kaiwa" Ruiter