eNarc
asked on
Pause a File Search
Hi, how do I search a folder and sub folders saving the path to a Stringlist.
when the file count reaches 1000 it will save the SL to a file and clears the SL back to 0 and carries on searching through the files.
the only problem that I'm having is that when its saving the sub directrices are still active and still searching, and it doesn't collect all the files.
as the file count in the files is not the file count that was counted so when its saving its missing files.
this is what I'm using to search, though how do I add the pause all the searches and when the save is complete it resumes all the searches
function BeginSearch(Path:string):s tring;
var
sr: TSearchRec;
begin
Path:=IncludeTrailingBackS lash(Path) ;
if FindFirst(Path + '*.*', faAnyFile, sr) = 0 then begin
repeat
Application.ProcessMessage s;
if (sr.Name <> '.') and (sr.Name <> '..') then begin
if (sr.Attr and faDirectory)>0 then begin
BeginSearch(Path+sr.Name);
end else begin
FileSL.add(Path+sr.Name);
end;
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
end;
when the file count reaches 1000 it will save the SL to a file and clears the SL back to 0 and carries on searching through the files.
the only problem that I'm having is that when its saving the sub directrices are still active and still searching, and it doesn't collect all the files.
as the file count in the files is not the file count that was counted so when its saving its missing files.
this is what I'm using to search, though how do I add the pause all the searches and when the save is complete it resumes all the searches
function BeginSearch(Path:string):s
var
sr: TSearchRec;
begin
Path:=IncludeTrailingBackS
if FindFirst(Path + '*.*', faAnyFile, sr) = 0 then begin
repeat
Application.ProcessMessage
if (sr.Name <> '.') and (sr.Name <> '..') then begin
if (sr.Attr and faDirectory)>0 then begin
BeginSearch(Path+sr.Name);
end else begin
FileSL.add(Path+sr.Name);
end;
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
good
ASKER