Einzelnen Beitrag anzeigen

Benutzerbild von dummzeuch
dummzeuch

Registriert seit: 11. Aug 2012
Ort: Essen
1.559 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#2

AW: FileExists mit Wildecard-Support

  Alt 31. Jul 2022, 17:23
TFilesystem.FindMatchingFile aus meiner dzLib:

https://osdn.net/projects/dzlib-tool...zFileUtils.pas

Delphi-Quellcode:
class function TFileSystem.FindMatchingFile(const _Mask: string; out _Filename: string): TMatchingFileResult;
var
  Sr: TSearchRec;
begin
  Result := mfNotFound;
  if 0 = FindFirst(_Mask, faAnyFile, Sr) then
    try
      repeat
        if (Sr.Name <> '.') and (Sr.Name <> '..') then begin
          _Filename := Sr.Name;
          if (Sr.Attr and SysUtils.faDirectory) <> 0 then
            Result := mfDirectory
          else
            Result := mfFile;
          Exit;
        end;
      until 0 <> FindNext(Sr);
    finally
      FindClose(Sr);
    end;
end;
Thomas Mueller
  Mit Zitat antworten Zitat