File search using c sharp
I want to search a file in all logical drives in computer using c sharp
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Mar 22, 2011, 1:34 AM EDT
To search all logical drives you'll need to use DriveInfo.GetDrives (http://msdn.microsoft.com/en-us/library/system.io.driveinfo.getdrives.aspx ) to iterate through each drive and then apply the recursive search method to each one in turn.
Notice that, if there are a lot of files on a drive, this method is very slow - much slower than the search facilities built into Windows itself which cache info internally to speed up the search.