Directory.EnumerateFiles Method
var txtFiles = Directory.EnumerateFiles(sourceDirectory, "*.doc*", SearchOption.AllDirectories);
foreach (string currentFile in txtFiles)
{
...
}
If you want something more efficient:
The good folks over at http://visuallogparser.codeplex.com/ have
provided us with the source code.
Open the VisualLogParser solution in VS2010, ignore the prompt about debugging, after the solution loads, F5, set the combo-box to FS (FileSystem), paste in this query and press go.
SELECT
ContentPath, [Days (Old)], FileName, [Creation Date Time]
USING creationtime AS [Creation Date Time],
TO_DATE([Creation Date Time]) AS Cdate,
SUB(TO_LOCALTIME(SYSTEM_TIMESTAMP()), Cdate) AS Days,
DIV(TO_INT(Days),86400) As [Days (Old)],
EXTRACT_PATH(TO_LOWERCASE(path)) AS ContentPath,
TO_LOWERCASE(name) AS FileName
FROM 'c:\*.doc'
WHERE
(attributes NOT LIKE 'D%')
AND
([Days (Old)] >= TO_INT('0'))
ORDER BY [Creation Date Time] DESC