Einzelnen Beitrag anzeigen

moelski

Registriert seit: 31. Jul 2004
1.110 Beiträge
 
Delphi 2010 Professional
 
#18

Re: Verzeichnis im Startmenü löschen

  Alt 7. Jul 2009, 21:59
Moin !

So nun schaut das schon etwas universeller und läuft ohne Fehler

Delphi-Quellcode:
Procedure ReadAllFilesInDir(mask: string; Var Liste : TStringList;
                            readFolder, readFiles : Boolean);
var sr : TSearchRec;
    directory : string;
begin
  directory := ExtractFilePath(mask);

  if FindFirst(mask, faAnyFile, sr) = 0 then
  begin
    repeat
      if (lowercase(sr.Name) <> 'make.exe') and
         (lowercase(sr.Name) <> 'install.xml') and
         (sr.Name <> '.') and
         (sr.Name <> '..') and
         ((sr.Attr and faDirectory) <> faDirectory) then
        if readFiles then
          Liste.Add(ExpandFileName(directory + sr.Name));

      if ((sr.Attr and faDirectory) = faDirectory) and
         (sr.Name <> '.') and
         (sr.Name <> '..') then begin
        if readFolder then
          Liste.Add(ExpandFileName(directory + sr.Name));
        ReadAllFilesInDir(directory + sr.Name + '\' + ExtractFileName(mask), Liste, readFolder, readFiles);
      end;
    until FindNext(sr) <> 0;
    FindClose(sr);
  end;
end;
Dominik Schmidt
Greetz Dominik

I love Delphi 2007/2010
  Mit Zitat antworten Zitat