Как загрузить папку с подкаталогами и файлами в TTreeView.

14:22
procedure FilePathToTreeNode(aTreeView:TTreeView; aRoot:TTreeNode; Path:string; Recurse:boolean); 
var
NewNode : TTreeNode;
SRec : TSearchRec;
begin
if FindFirst(Path + '*.*', SysUtils.faAnyFile, SRec) = 0 then
repeat
if (sRec.Name = '.') or (sRec.Name = '..') then
Continue;
 
NewNode := aTreeView.Items.AddChild(aRoot, SRec.Name);
if Recurse and ((srec.Attr and sysutils.faDirectory) <> 0) then
FilePathToTreeNode(aTreeView, NewNode, Path + srec.name + '\', True);
 
until FindNext(SRec) <> 0;
FindClose(SRec);
end;
 
//Call it like this:
FilePathToTreeNode(TreeView1, nil, 'c:\', True);