a sceleton
procedure FindFile(PathFileName : string; IncludeSubDirs : Boolean);
var
srec : TSearchRec;
Path, FileName : String;
begin
Path := ExtractFilePath(PathFileNa
FileName := ExtractFileName(PathFileNa
// CurrentDirectory
if findfirst(PathFileName,faa
begin
repeat
If Not(srec.attr and fadirectory > 0) then
begin
// FileFound do something with it
// maybe add to list or count it
showmessage('Found :'+Path+SRec.Name);
end;
Until findnext(srec) <> 0;
end;
FindClose(SRec);
{ SubDirectories }
If IncludeSubDirs then
begin
if FindFirst(Path+'*.*',FaAny
begin
repeat
// StartRecursion
if not(Srec.Name[1] = '.') and (srec.attr and fadirectory > 0)then
FindFile(Path + Srec.Name + '\' + FileName,IncludeSubDirs)
Until findnext(srec) <> 0;
end;
FindClose(SRec);
end;
end;
modify it for your needs
meikl ;-)
Main Topics
Browse All Topics





by: ziolkoPosted on 2003-01-21 at 22:27:22ID: 7777410
procedure TForm1.Button1Click(Sender : TObject); *.*',fd); ount));
var h: THandle;
fd: TWIN32FindDataA;
FileCount: Integer;
more: Boolean;
begin
FileCount:=0;
h:=FindFirstFile('c:\data\
more:=h<>0;
while more do
begin
more:=FindNextFile(h,fd);
Inc(FileCount);
end;
ShowMessage(IntToStr(FileC
end;
ziolko.