using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class Program
{
static void Main(string[] args)
{
try
{
// LINQ query for all files containing the word 'Europe'.
var files = from file in
Directory.EnumerateFiles("c:\\")
where file.ToLower().Contains("europe")
select file;
// Show results.
foreach (var file in files)
{
Console.WriteLine("{0}", file);
}
Console.WriteLine("{0} files found.", files.Count().ToString());
}
catch (UnauthorizedAccessException UAEx)
{
Console.WriteLine(UAEx.Message);
}
catch (PathTooLongException PathEx)
{
Console.WriteLine(PathEx.Message);
}
}
}