给你写一个吧,不过错误控制要自己加一下<br>Function DelTree(Path:String):Boolean;<br>Var<br> Found:Integer;<br> SearchRec:TSearchRec;<br>begin<br> Found := FindFirst(path+'*.*', $0000003F, SearchRec);<br> While Found = 0 Do<br> Begin<br> If ((SearchRec.Name<>'.') And (SearchRec.Name<>'..') )<br> Then<br> Begin<br> If (SearchRec.Attr = $00000010)<br> Then<br> DelTree(Path+SearchRec.Name+'/')<br> Else<br> DeleteFile(Path+SearchRec.Name);<br> End;<br> Found := FindNext(SearchRec);<br> End;<br> FindClose(SearchRec);<br> RmDir(Path);<br>End;<br><br>DelTree('C:/Temp/');