Created
March 5, 2021 07:54
-
-
Save mattia72/b167d1c7807872959aa77774f394c0d6 to your computer and use it in GitHub Desktop.
Get files in directory by filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetFiles(const _sVerzeichnis: string): TStringDynArray; | |
const | |
FILTER : array [1..2] of string = ('*.zip', '*.7z'); | |
begin | |
Result := TDirectory.GetFiles(_sVerzeichnis, TSearchOption.soAllDirectories, | |
function(const Path: string; const SearchRec: TSearchRec): Boolean | |
var | |
Mask: string; | |
begin | |
for Mask in FILTER do | |
if MatchesMask(SearchRec.Name, Mask) then | |
exit(True); | |
exit(False); | |
end); | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment