Skip to content

Instantly share code, notes, and snippets.

@mattia72
Created March 5, 2021 07:54
Show Gist options
  • Save mattia72/b167d1c7807872959aa77774f394c0d6 to your computer and use it in GitHub Desktop.
Save mattia72/b167d1c7807872959aa77774f394c0d6 to your computer and use it in GitHub Desktop.
Get files in directory by filter
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