// Retrieve the list of specified type files in the specified file category and its sub-Files
Procedure _ getfilelist (astrings: tstrings; asourfile, filename: string );
// Usage example: _ getfilelist (filelist, 'c: // ',' *. pa ')
VaR
Sour_path, sour_file: string;
Tmplist: tstringlist;
Filerec, subfilerec: tsearchrec;
I: integer;
Begin
If rightstr (TRIM (asourfile), 1) <> '/' then
Sour_path: = trim (asourfile) + '/'
Else
Sour_path: = trim (asourfile );
Sour_file: = filename;
If not directoryexists (sour_path) then
Begin
Astrings. Clear;
Exit;
End;
Tmplist: = tstringlist. Create;
Tmplist. Clear;
If findfirst (sour_path + filename, faanyfile, filerec) = 0 then
Repeat
If (filerec. ATTR and fadirectory) = 0) then
Astrings. Add (sour_path + filerec. Name );
Until findnext (filerec) <> 0;
If findfirst (sour_path + '*. *', faanyfile, filerec) = 0 then
Repeat
If (filerec. ATTR and fadirectory) <> 0) then
Begin
If (filerec. Name <> '.') and (filerec. Name <> '..') then
_ Getfilelist (astrings, sour_path + filerec. Name + '/', sour_file );
End;
Until findnext (filerec) <> 0;
Findclose (filerec );
End;