//在论坛里搜索了很多,都用到什么chdir,都不好用,
//所以自己写个最简洁的贡献出来。function Deltree(sDir: string): Boolean;
var
        hFindFile: HWND;
        FindFileData: WIN32_FIND_DATA;
        sr: TSearchRec;
begin
        sDir:= sDir + '\';        hFindFile:= FindFirstFile(pchar(sDir + '*.*'), FindFileData);
        if hFindFile <> NULL then
        begin
                while FindNextFile(hFindFile, FindFileData) <> FALSE do
                begin
                        if FindFileData.dwFileAttributes in [FILE_ATTRIBUTE_DIRECTORY] then
                        begin
                                if (strpas(FindFileData.cFileName) <> '.') and (strpas(FindFileData.cFileName) <> '..') then
                                begin
                                        Deltree(sDir + FindFileData.cFileName);
                                end;
                        end
                        else begin
                                deletefile(sDir + FindFileData.cFileName);
                        end;
                end;
        end;
        sr.FindHandle:= hFindFile;
        FindClose(sr);
        RemoveDir(sDir);
end;