Been working on a school project and I'm kinda stuck. I've been trying to write something like this, however it doesn't work. Is there any way to look for a file, delete it, but not knowing the exact path of the file?
var files = new List<string>();
foreach (DriveInfo d in DriveInfo.GetDrives().Where(x => x.IsReady == true))
{
files.AddRange(Directory.GetFiles(d.RootDirectory.FullName, "x.jpg", SearchOption.AllDirectories));
}
if (File.Exists(files))
{
File.Delete(files);
}