Method filesystem.enumFiles
Overload
Gets names and other info of matching files in the specified directory.
public static IEnumerable<FEFile> enumFiles(string directoryPath, string pattern = null, FEFlags flags = 0)
Parameters
directoryPath (string)
Full path of the directory. |
pattern (string)
File name pattern. Format: wildcard expression. Used only for files, not for subdirectories. Can be
|
flags (FEFlags)
Flags. The function also adds flag OnlyFiles. |
Returns
IEnumerable<FEFile>
An enumerable collection of FEFile objects. |
Exceptions
ArgumentException
directoryPath is invalid path or not full path.
Invalid pattern ( |
DirectoryNotFoundException
directoryPath directory does not exist. |
AuException
Failed to get children of directoryPath or of a subdirectory. |
Remarks
Uses API FindFirstFile.
By default gets only direct children. Use flag FEFlags.AllDescendants to get all descendants.
The paths that this function gets are normalized, ie may not start with exact directoryPath string. Expanded environment variables (see pathname.expand), ".."
, DOS path etc. Paths longer than pathname.maxDirectoryPathLength have @"\\?\"
prefix (see pathname.prefixLongPathIfNeed).
For NTFS links (symbolic links, mount points) gets link info, not target info.
These errors are ignored:
- Missing target directory of a NTFS link.
- If used flag FEFlags.IgnoreInaccessible - access denied.
When an error is ignored, the function works as if that [sub]directory is empty; does not throw exception and does not call errorHandler.
Enumeration of a subdirectory starts immediately after the subdirectory itself is retrieved.