Autor Beitrag
Larus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 431



BeitragVerfasst: Sa 12.02.05 22:32 
Wie kann ich einen Ordner wählen lassen und dann eine Liste des gesamten Inhaltes erstellen? zuzüglich der Inhalte jeglicher Unterordner des Ordners und deren Unterordner???
mimi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: So 13.02.05 08:38 
z.b. mit dieser Funktion:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
function ReadDir(Path, Mask:string; ShowPath: boolean): TStringlist;
var
  SL: TStringList;
  SRec: TSearchRec;  
begin
  SL := TStringList.Create;
  FindFirst(Path + Mask + #0, not faDirectory, SRec);
  if ShowPath then
    SL.Add(Path + SRec.Name)
  else
    SL.Add(SRec.Name);
  while FindNext(SRec) = 0 do
    if ShowPath then
      SL.Add(Path + SRec.Name)
    else
      SL.Add(SRec.Name);

  FindClose(SRec);
  Result := SL;
end;

_________________
MFG
Michael Springwald, "kann kein englisch...."
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: So 13.02.05 09:03 
Larus hat folgendes geschrieben:
Wie kann ich einen Ordner wählen lassen und dann eine Liste des gesamten Inhaltes erstellen? zuzüglich der Inhalte jeglicher Unterordner des Ordners und deren Unterordner???

ausblenden Delphi-Quelltext
1:
uses FileCtrl;					

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
procedure TForm1.Button1Click(Sender: TObject);

  procedure FindFiles(const Path: String; FileList: TStringList);
  var
    SR: TSearchRec;
  begin

    if FindFirst(Path + '*.*', faAnyFile, SR) = 0 then
    begin
      repeat
        if not (SR.Name = String('.')) and not (SR.Name = '..') then
        begin
          FileList.Add(Path + SR.Name);
          if (SR.Attr or faDirectory) = SR.Attr then
            FindFiles(IncludeTrailingBackslash(Path + SR.Name), FileList);
        end;
      until FindNext(SR) <> 0;
      FindClose(SR);
    end;

  end;

var
  Directory: String;
  FileList: TStringList;
begin

  if SelectDirectory('Wähle ein Verzeichnis aus', '', Directory) then
  begin
    FileList := TStringList.Create;
    try
      FindFiles(IncludeTrailingBackslash(Directory), FileList);
      // in FileList befinden sich jetzt alle gefundenen Dateien und Verzeichnise
    finally
      FileList.Free;
    end;
  end;

end;

_________________
Ciao, Sprint.
Larus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 431



BeitragVerfasst: So 13.02.05 18:56 
Titel: Thx vorerst
Ich hoffe das funzt aber Thanks vorerst