Registriert seit: 3. Mär 2014
Ort: Berlin
434 Beiträge
Delphi 12 Athens
|
AW: Alle Filenamen
9. Mai 2024, 12:41
Das hier müsste auch unter Delphi 7 funktionieren:
Delphi-Quellcode:
procedure GetFileListEx(const Directory: string; const Files: TStrings; const FileMask: string; const SubFolders: Boolean);
var SearchRec: TSearchRec;
begin
Application.ProcessMessages;
if FindFirst(IncludeTrailingPathDelimiter(Directory)+FileMask, faAnyFile and not faDirectory and not faVolumeID and not faHidden, SearchRec) = 0 then
try repeat Files.Add(IncludeTrailingPathDelimiter(directory)+SearchRec.Name);
until FindNext(SearchRec) <> 0;
finally SysUtils.FindClose(SearchRec); end;
if SubFolders then
if FindFirst(IncludeTrailingPathDelimiter(Directory)+'*.*', faAnyFile, SearchRec) = 0 then
try repeat
if (SearchRec.Attr and faDirectory) <> 0 then
if ((SearchRec.Name <> '.') and (SearchRec.Name <> '..'))
then GetFileListEx(IncludeTrailingPathDelimiter(Directory)+SearchRec.Name, Files, FileMask, SubFolders);
until FindNext(SearchRec) <> 0;
finally SysUtils.FindClose(SearchRec); end;
end;
|
|
Zitat
|