function DaFileCopy(sourdirstr,tardirstr:AnsiString):boolean;<br>var<br> SeRec:TSearchRec;<br>begin<br> CreateDir(tardirstr);<br> Result:=true;<br> if DirectoryExists(tardirstr) and DirectoryExists(sourdirstr) then<br> try<br> if( FindFirst(sourdirstr+'/*.DOC',faAnyFile,SeRec)=0) then<br> begin<br> repeat<br> if ((SeRec.Name<>'.') and (SeRec.Name<>'..')) then<br> if SeRec.Attr=faDirectory then<br> begin<br> if not DaFileCopy(sourdirstr+'/'+SeRec.Name,tardirstr+'/'+SeRec.Name) then<br> Result:=false; <br> end<br> else if SeRec.Attr=$00000020 then<br> CopyFile(Pchar(sourdirstr+'/'+SeRec.Name),Pchar(tardirstr+'/'+SeRec.Name),true);<br> until FindNext(SeRec) <> 0;<br> FindClose(SeRec);<br> end;<br> except<br> Result:=false;<br> end<br> else<br> Result:=false;<br>end;