C
Chris
I'm writing an application that does a scan on all the files for a given
drive letter.
Ideally what I want is to have a list of keywords that my program will
ignore and not scan.
For example:
For Each fileInfo As FileInfo In FilesArray
If fileInfo.FullName.ToUpper.Contains( a keyword in the list of
keywords ) then
'do nothing
Else
'do something important
End If
Next
As compared to the following mess that I have now:
For Each fileInfo As FileInfo In FilesArray
'Do not look at files that cause lots of noise and are of no
intrest
If fileInfo.FullName.ToUpper.Contains("RECYCLER") Or _
fileInfo.FullName.ToUpper.Contains("WINDOWS") Or _
fileInfo.FullName.ToUpper.Contains("WINNT") Or _
fileInfo.FullName.ToUpper.Contains("LOG") Or _
fileInfo.FullName.ToUpper.Contains("DUMP") Or _
fileInfo.FullName.ToUpper.Contains("APPLICATION DATA") Or _
fileInfo.FullName.ToUpper.Contains("SETUP") Or _
fileInfo.FullName.ToUpper.Contains("LOCAL SETTINGS") Or _
fileInfo.FullName.ToUpper.Contains("COOKIES") Then
'Do nothing
Else
'We have a file of intrest
'Do something with it
Next
The list that I test against is actually about 10 times longer than the
above list. I'm just thinking that there has to be a more readable/compact
way of doing this.
I also need the feature to dynamically add/remove items from the "ignore"
list, which makes me think of a using a collection.
Thanks for any help,
Chris
drive letter.
Ideally what I want is to have a list of keywords that my program will
ignore and not scan.
For example:
For Each fileInfo As FileInfo In FilesArray
If fileInfo.FullName.ToUpper.Contains( a keyword in the list of
keywords ) then
'do nothing
Else
'do something important
End If
Next
As compared to the following mess that I have now:
For Each fileInfo As FileInfo In FilesArray
'Do not look at files that cause lots of noise and are of no
intrest
If fileInfo.FullName.ToUpper.Contains("RECYCLER") Or _
fileInfo.FullName.ToUpper.Contains("WINDOWS") Or _
fileInfo.FullName.ToUpper.Contains("WINNT") Or _
fileInfo.FullName.ToUpper.Contains("LOG") Or _
fileInfo.FullName.ToUpper.Contains("DUMP") Or _
fileInfo.FullName.ToUpper.Contains("APPLICATION DATA") Or _
fileInfo.FullName.ToUpper.Contains("SETUP") Or _
fileInfo.FullName.ToUpper.Contains("LOCAL SETTINGS") Or _
fileInfo.FullName.ToUpper.Contains("COOKIES") Then
'Do nothing
Else
'We have a file of intrest
'Do something with it
Next
The list that I test against is actually about 10 times longer than the
above list. I'm just thinking that there has to be a more readable/compact
way of doing this.
I also need the feature to dynamically add/remove items from the "ignore"
list, which makes me think of a using a collection.
Thanks for any help,
Chris