TomLenen
asked on
[DELPHI] File Search
Hello all,
I'm trying to get my app to do a file search. It should search all drives and sub directories for a certain file(s). Some example source would be nice any help is highly appreciated. Thanx.
Sincerely, Tom Lenen
I'm trying to get my app to do a file search. It should search all drives and sub directories for a certain file(s). Some example source would be nice any help is highly appreciated. Thanx.
Sincerely, Tom Lenen
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi
Below is a procedure which will search through a directory looking for all file times with the extention .jpg
Hope this helps
procedure FindImages;
begin
var
Search: TSearchRec;
Path : String;
Error: Integer;
Bmp: TJPEGImage;
i : SmallInt;
begin
Error := FindFirst(Path + '*.jpg', faAnyFile - faDirectory, Search);
if (Error = 0) then
begin
i := 0;
SetLength(BmpArray,TotalIm ages);
while (Error = 0) do
begin
Bmp := TJPEGImage.Create;
Bmp.LoadFromFile(Path + Search.Name);
BmpArray[i] := Bmp;
Error := FindNext(Search);
inc(i)
end;
FindClose(Search);
end;
end;
end;
Regards
TAZI
Below is a procedure which will search through a directory looking for all file times with the extention .jpg
Hope this helps
procedure FindImages;
begin
var
Search: TSearchRec;
Path : String;
Error: Integer;
Bmp: TJPEGImage;
i : SmallInt;
begin
Error := FindFirst(Path + '*.jpg', faAnyFile - faDirectory, Search);
if (Error = 0) then
begin
i := 0;
SetLength(BmpArray,TotalIm
while (Error = 0) do
begin
Bmp := TJPEGImage.Create;
Bmp.LoadFromFile(Path + Search.Name);
BmpArray[i] := Bmp;
Error := FindNext(Search);
inc(i)
end;
FindClose(Search);
end;
end;
end;
Regards
TAZI
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
TomLenen:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
Hi!
No comment has been added lately and this question is therefore classified abandoned.
If asker wishes to close the question, then refer to
https://www.experts-exchange.com/help/closing.jsp
Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:
Split between ILE and merry_prince
Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
...Snehanshu
EE Cleanup Volunteer
No comment has been added lately and this question is therefore classified abandoned.
If asker wishes to close the question, then refer to
https://www.experts-exchange.com/help/closing.jsp
Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:
Split between ILE and merry_prince
Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
...Snehanshu
EE Cleanup Volunteer
If your drive is very large and/or your directory structure very complex then you may wish to capture the sub-directories in a list and process them after closing the main routine's find.
Because of the nature of Windows I/O, this recursive function is also susceptible to speedup by multi-threading. Off the top of my head, I estimate that you can get at least three times the overall performance and possibly better by careful use of multi-threading. I suggest no more than three threads per CPU.