Click here to Skip to main content
15,888,521 members
Home / Discussions / C#
   

C#

 
QuestionThrottle user input Pin
edlanka29-May-09 3:30
edlanka29-May-09 3:30 
AnswerRe: Throttle user input Pin
Ennis Ray Lynch, Jr.29-May-09 3:44
Ennis Ray Lynch, Jr.29-May-09 3:44 
AnswerRe: Throttle user input Pin
Luc Pattyn29-May-09 3:53
sitebuilderLuc Pattyn29-May-09 3:53 
QuestionConnecting C# desktop application with web database Pin
sachees12329-May-09 2:31
sachees12329-May-09 2:31 
AnswerRe: Connecting C# desktop application with web database Pin
Paddy Boyd29-May-09 2:35
Paddy Boyd29-May-09 2:35 
AnswerRe: Connecting C# desktop application with web database Pin
Henry Minute29-May-09 2:46
Henry Minute29-May-09 2:46 
AnswerRe: Connecting C# desktop application with web database Pin
Rob Philpott29-May-09 2:59
Rob Philpott29-May-09 2:59 
AnswerRe: Connecting C# desktop application with web database Pin
benjamin yap29-May-09 6:49
benjamin yap29-May-09 6:49 
Questionfind files Pin
michaelgr129-May-09 2:26
michaelgr129-May-09 2:26 
AnswerRe: find files Pin
I Believe In GOD29-May-09 2:28
I Believe In GOD29-May-09 2:28 
GeneralRe: find files Pin
musefan29-May-09 2:33
musefan29-May-09 2:33 
GeneralRe: find files Pin
Rob Philpott29-May-09 3:17
Rob Philpott29-May-09 3:17 
GeneralRe: find files Pin
Baeltazor29-May-09 3:35
Baeltazor29-May-09 3:35 
GeneralRe: find files Pin
Luc Pattyn29-May-09 3:59
sitebuilderLuc Pattyn29-May-09 3:59 
GeneralRe: find files Pin
I Believe In GOD29-May-09 4:48
I Believe In GOD29-May-09 4:48 
GeneralRe: find files Pin
Mike Devenney29-May-09 5:41
Mike Devenney29-May-09 5:41 
AnswerRe: find files Pin
Rajesh R Subramanian29-May-09 2:31
professionalRajesh R Subramanian29-May-09 2:31 
AnswerRe: find files [modified] Pin
musefan29-May-09 2:31
musefan29-May-09 2:31 
well like you said, write a recursive function. Basic idea...

using System.IO;


string FindFile(string initDirectory, string fileToFind)
{
  DirectoryInfo dir = new DirectoryInfo(initDirectory);
  foreach(FileInfo file in dir.GetFiles())
  {
    if(file.Name == fileToFind)
       return file.FullName;
  }
  foreach(DirectoryInfo subDir in dir.GetDirectories())
  {
    return FindFile(subDir.FullName, fileToFind);
  }
  return null;
}


..that should do the trick, if not I hope you get the idea

Life goes very fast. Tomorrow, today is already yesterday.

modified on Friday, May 29, 2009 9:03 AM

GeneralRe: find files Pin
michaelgr129-May-09 3:00
michaelgr129-May-09 3:00 
GeneralRe: find files Pin
musefan29-May-09 3:05
musefan29-May-09 3:05 
GeneralRe: find files Pin
michaelgr129-May-09 3:17
michaelgr129-May-09 3:17 
GeneralRe: find files Pin
musefan29-May-09 3:20
musefan29-May-09 3:20 
GeneralRe: find files Pin
michaelgr129-May-09 3:23
michaelgr129-May-09 3:23 
GeneralRe: find files Pin
michaelgr129-May-09 3:25
michaelgr129-May-09 3:25 
GeneralRe: find files Pin
musefan29-May-09 3:32
musefan29-May-09 3:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.