If you don't know where the file is you are looking for, you can recursively search for it: (set initial dir to C:\ for instance)
void DirSearch(string sDir)
{
try
{
foreach (string d in Directory.GetDirectories(s
{
foreach (string f in Directory.GetFiles(d, txtFile.Text))
{
lstFilesFound.Items.Add(f)
}
DirSearch(d);
}
}
catch (System.Exception excpt)
{
Console.WriteLine(excpt.Me
}
}
Main Topics
Browse All Topics





by: ITTechSolverPosted on 2007-11-10 at 10:16:12ID: 20256529
string file = "file.txt"; ile)) );
if(System.IO.File.Exists(f
{
System.IO.File.Delete(file
}
else
{
// anything else
}