/// <summary> /// Search the file in the shared file path /// </summary> /// <param name="path">Search path</param> /// <param name="fileName">File name will be searched</param> /// <param name="fileFullName">Full name(including path, file name and extention)</param> private void ParseDirectory(string path, string fileName, ref string fileFullName) { string[] directorys = Directory.GetDirectories(path); foreach (string directory in directorys) { //do the recursion search in the sub directory. ParseDirectory(directory, fileName,ref fileFullName); } string[] files = Directory.GetFiles(path); if (files.Length > 0) { foreach (string file in files) { FileInfo info = new FileInfo(file); if (info.Name == fileName) { fileFullName = info.FullName; } } } }