Autor Beitrag
Sauger Chris
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: Do 15.11.07 19:19 
moin wolte mal fragen wie ich einen ordner nach einer datei durchsuche

er soll mir alle dateien die in dem dateien name ein Found enthalten ausgeben


also die dateien heißen zum bleistift so


01.11:17.00_Found.txt
03.11:18.00.txt


thx 4 help


ps. bis jetzt hab ich mal den hier benützt

ausblenden 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:
procedure FindFiles(sPfad: String);
var Rec:TSearchRec;
begin
   //Die beiden ersten gefundenen Einträge ignorieren
   FindFirst(sPfad+'\*.*', faAnyFile,Rec);
   FindNext(Rec);


   if FindNext(Rec)=0 then
   begin
     repeat
       if (Rec.Attr and faDirectory = faDirectory) then begin
         FindFiles(sPfad+'\'+Rec.Name);
       end
       else begin
        if ExtractFileExt(Rec.Name) = '*.txt' then begin
          ShowMessage(sPfad+'\'+Rec.Name);
        end;
       end;
     until FindNext(Rec)<>0;
   end;
   Findclose(Rec);
end;
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Do 15.11.07 21:24 
Hi!

Hier gibt's die procedure GetFilesInDirectory. In deinem Fall müsste dann ein Aufruf so aussehen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
  GetFilesInDirectory('C:\', '*found*.*', Listbox1.Items, False, True);
end;


Gruß

Calculon
--
Sauger Chris Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: Do 15.11.07 23:17 
thx genau das is es :)
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Do 15.11.07 23:40 
No problemo. Wir Schwaben müssen doch zusammenhalten ;-)
Jonathanubx
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 32



BeitragVerfasst: Fr 23.11.07 13:32 
hi,
ich hab ein ähnliches problem, allerdings funktioniert bei mir der befehl GetFilesInDirectory nicht.
ich hab delphi 7 Ent. muss ich da irgendwas beachten, irgendwas irgendwo noch eintragen o.ä.?

Ich hoffe ihr helft mir, auch wenn ich kein schwabe bin ;-)
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Fr 23.11.07 13:39 
Zeig' mal deinen bisherigen Code, dann kann man dir weiterhelfen. Mit Delphi 7 sollte es eigentlich schon gehen.