UtilFileGetFiles(DirectoryInfo, SearchOption, IEnumerableString, IEnumerableString, Boolean, Boolean) Method
Gets the files those matches the criteria inside the specified directory and/or sub-directories.
Namespace: DevCase.Core.IO.FileSystemAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static IEnumerable<FileInfo> GetFiles(
DirectoryInfo dir,
SearchOption searchOption,
IEnumerable<string> fileNamePatterns = null,
IEnumerable<string> fileExtPatterns = null,
bool ignoreCase = true,
bool throwOnError = false
)
Public Shared Function GetFiles (
dir As DirectoryInfo,
searchOption As SearchOption,
Optional fileNamePatterns As IEnumerable(Of String) = Nothing,
Optional fileExtPatterns As IEnumerable(Of String) = Nothing,
Optional ignoreCase As Boolean = true,
Optional throwOnError As Boolean = false
) As IEnumerable(Of FileInfo)
Dim dir As DirectoryInfo
Dim searchOption As SearchOption
Dim fileNamePatterns As IEnumerable(Of String)
Dim fileExtPatterns As IEnumerable(Of String)
Dim ignoreCase As Boolean
Dim throwOnError As Boolean
Dim returnValue As IEnumerable(Of FileInfo)
returnValue = UtilFile.GetFiles(dir,
searchOption, fileNamePatterns,
fileExtPatterns, ignoreCase, throwOnError)
public:
static IEnumerable<FileInfo^>^ GetFiles(
DirectoryInfo^ dir,
SearchOption searchOption,
IEnumerable<String^>^ fileNamePatterns = nullptr,
IEnumerable<String^>^ fileExtPatterns = nullptr,
bool ignoreCase = true,
bool throwOnError = false
)
static member GetFiles :
dir : DirectoryInfo *
searchOption : SearchOption *
?fileNamePatterns : IEnumerable<string> *
?fileExtPatterns : IEnumerable<string> *
?ignoreCase : bool *
?throwOnError : bool
(* Defaults:
let _fileNamePatterns = defaultArg fileNamePatterns null
let _fileExtPatterns = defaultArg fileExtPatterns null
let _ignoreCase = defaultArg ignoreCase true
let _throwOnError = defaultArg throwOnError false
*)
-> IEnumerable<FileInfo>
No code example is currently available or this language may not be supported.
- dir DirectoryInfo
-
The root directory path to search for files.
- searchOption SearchOption
-
The searching mode.
- fileNamePatterns IEnumerableString (Optional)
-
The file name pattern(s) to match.
- fileExtPatterns IEnumerableString (Optional)
-
The file extension pattern(s) to match.
- ignoreCase Boolean (Optional)
-
If , ignores the comparing case of fileNamePatterns and fileExtPatterns patterns.
- throwOnError Boolean (Optional)
-
If set to , exceptions will be thrown, like access denied to file or directory.
IEnumerableFileInfo
An
IEnumerableT instance containing the files information.
This is a code example.
No code example is currently available or this language may not be supported.
Dim files As List(Of FileInfo) =
GetFiles("C:\Windows\System32", SearchOption.AllDirectories).ToList
Dim files As IEnumerable(Of FileInfo) =
GetFiles(dirPath:="C:\Windows\System32",
searchOption:=SearchOption.TopDirectoryOnly,
fileNamePatterns:={"*"},
fileExtPatterns:={"*.dll", "*.exe"},
ignoreCase:=True,
throwOnError:=True)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
ArgumentException
|
dirPath or searchOption
|