I had the same problem. I repeated Word documents on the local hard drive and did some automation without saving files, just reading them.
I had *.doc files, and some had *.docx . I used
GetFiles ("* doc.");
GetFiles ("* DOCX.");
to process all files. However, the problem was that
GetFiles ("* doc.");
also finds \*.docx files, so .docx files were found twice.
Use something like this:
var strFileList = Directory.GetFiles(strDrvPth, strExtn).Where(s => s.EndsWith(strExtn.Substring(1)));
Substring(1) removes the "*" from the extension specification.
source share