Home > Back-end >  How to find the file?
How to find the file?

Time:02-03

How to make use of the DELPHI language, to find a particular file, the file storage path?

CodePudding user response:

Traverse? Demand is too fuzzy,,,

CodePudding user response:

Findfirst/findnext
Multistage subdirectories recursion depth

CodePudding user response:

FindFirst FindNext FindEnd;

Stick a I write their own functions;
 procedure GetSubFiles (Path, Ext: string; Var List: TStringList); 
Var
N: Integer;
F: TSearchRec;
The begin
If the Path [Length (Path)] <> The '\' then Path: the Path=+ '\';
N:=FindFirst (Path + '*. * ", 63, f);
While n=0 do
The begin
Application. ProcessMessages;
If ((ame) [1] <> '. ') then
The begin
If the Copy (motor ame, Length (ame) - (Length (ext) - 1), Length (ext))=ext then List. Add (Path + motor ame);
If f.A TTR event=faDirectory then GetSubFiles (Path + motor ame, ext, a List).
end;
N:=FindNext (f);
end;
end;


Look at this function recursive return all types of files to a list you to traverse the list and see the file again in no longer

CodePudding user response:

How to find the file
  • Related