//---------------删除目录树------------------------------------------------<br>FUNCTION FkDeleteTree(vFolder:STRING):Boolean;<br>VAR<br> srList: TSearchRec;<br> DirList: TStringList;<br> oFound,oTemp: Boolean;<br> i: integer;<br>BEGIN<br> oTemp:=True;<br> // 建立一个文件夹列表<br> DirList := TStringList.Create;<br> vFolder:=TRIM(vFolder);<br> IF vFolder[length(vFolder)]<>'/' THEN vFolder:=vFolder + '/';<br> // 生成文件夹列表<br> oFound:=FindFirst(vFolder+'*.*',(faDirectory+faHidden+faSysFile), srList) = 0;<br> WHILE oFound DO<br> BEGIN<br> IF (DirectoryExists(vFolder+srList.Name) and (srList.Name<>'.') AND (srList.Name<>'..')) THEN<br> DirList.Add(vFolder+srList.Name);<br> oFound :=(FindNext(srList)=0);<br> END;<br> FindClose(srList);<br> //查找当前目录的文件删除<br> oFound:=FindFirst(vFolder+'*.*',(faAnyFile+faHidden+faSysFile+faReadOnly), srList) = 0;<br> WHILE oFound DO<br> BEGIN<br> FileSetAttr(vFolder+srList.Name,0);<br> oTemp:=DeleteFile(vFolder+srList.Name) and oTemp;<br> oFound:=(FindNext(srList)=0);<br> END;<br> FindClose(srList);<br> //查找列表的子目录<br> FOR i := 0 TO DirList.Count-1 DO FkDeleteTree(DirList);<br> FileSetAttr(vFolder,0);<br> oTemp:=RemoveDir(vFolder) AND oTemp;<br> DirList.Free;<br> Result:=oTemp;<br>END;<br>//--------------------------------------------------------------<br>