我用以下代码,效果很好.<br>procedure mycopyfile(s,d:string);<br>var<br> sr,temp:tsearchrec;<br>begin<br><br> if findfirst(s+'/*.*',faanyfile,sr)=0 then<br> begin<br> if (sr.name<> '.')and(sr.name<>'..') then<br> begin<br> if sr.Attr=fadirectory then<br> begin<br> if findfirst(d+'/'+sr.name,faanyfile,temp)=0 then<br> createdirectory(pchar(d+'/'+sr.name),lps);<br> mycopyfile(s+'/'+sr.name,d+'/'+sr.name);<br> end<br> else<br> copyfile(pchar(s+'/'+sr.name),pchar(d+'/'+sr.name),false);<br> end;<br> while findnext(sr)=0 do<br> begin<br> if (sr.name<> '.')and(sr.name<>'..') then<br> if sr.Attr=fadirectory then<br> begin<br> if findfirst(PCHAR(d+'/'+sr.name),fadirectory,temp)<>0 then<br> createdirectory(pchar(d+'/'+sr.name),lps);<br> temp:=sr;<br> mycopyfile(s+'/'+sr.name,d+'/'+sr.name);<br> sr:=temp;<br> end<br> else<br> copyfile(pchar(s+'/'+sr.name),pchar(d+'/'+sr.name),false);<br> <br> end;<br> findclose(sr);<br> end;<br>end;