The AttributeFilter class can be used to filter files and folders according to their attributes. The attributes are specified by using the FileAttributes enumeration.
Demonstration
Process all files that have the read-only attribute.
VB.NET | Copy Code |
---|---|
Dim files As AbstractFile() = myFolder.GetFiles( True, _ |
C# | Copy Code |
---|---|
AbstractFile[] files = myFolder.GetFiles( true, |
Process all files that have both the read-only and the hidden attribute.
VB.NET | Copy Code |
---|---|
|
C# | Copy Code |
---|---|
|
Process all files that have either the read-only or hidden attribute.
VB.NET | Copy Code |
---|---|
Dim files As AbstractFile() = myFolder.GetFiles( True, _ |
C# | Copy Code |
---|---|
AbstractFile[] files = myFolder.GetFiles( true, |
The pipe (|) used in the constructor of the AttributeFilter class serves the same purpose as an OrFilter class.
Things you should consider
-
Do you only want to target specific types of folder items? Use the FilterScope enumeration in the constructor of the AttributeFilter class.