Thread: [SOLVED] File Search
View Single Post
  #5  
Old 09-26-2016, 10:46 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default

yes you have the basic idea

myseach = class(TObject)
private
FList: Stringlist;

public
create
Distroy
Procedure search(Dir: String);
function ReadFileList: Stringlist; // only read the list
end;

Create
begin
FList := TStringList.Create;
iIndex := FindFirst(sPath+sMask, faArchive, SearchRec);
end;

search
Var iIndex : Integer;
SearchRec : TSearchRec;
// data re added to stack with each subdir or recall of procedure
begin
repeat
Findnext
IF aDir then Search(SubDir); // loops into subdir and returns back hear
If FileIWant then FList.add();
Until ..........
end;

destroy
begin
FindClose(SearchRec);
FList.free;
end;

//This can search all of C drive easily
// read about objects and look at 'Classes.pas' file for examples