D
Demetri
Using the GetFiles method of the DirectoryInfo instance
one can pass in a search pattern of string type.
For example:
DirectoryInfo di = new DirectoryInfo("C:\temp");
FileInfo[] fi = di.GetFiles("*.doc");
That code would return all the files with the doc
extension in the C:\temp folder. No problem.
However, suppose I want all the files that have the
word "Corporate" and "Audit" and "finance" in the files
name (not the files contents)?
This means if there are two files:
1. System finance.doc
2. Audit Finance Corporate.doc
The above should return just file number 2 since it
satisfies the requirement to have those three words in the
files name.
Any ideas on how to implement this?
one can pass in a search pattern of string type.
For example:
DirectoryInfo di = new DirectoryInfo("C:\temp");
FileInfo[] fi = di.GetFiles("*.doc");
That code would return all the files with the doc
extension in the C:\temp folder. No problem.
However, suppose I want all the files that have the
word "Corporate" and "Audit" and "finance" in the files
name (not the files contents)?
This means if there are two files:
1. System finance.doc
2. Audit Finance Corporate.doc
The above should return just file number 2 since it
satisfies the requirement to have those three words in the
files name.
Any ideas on how to implement this?