什么呀,我是指用Delphi编成实现!

解决方案 »

  1.   

    方案1:
    用FindFirst、FindNext、FindClose来查找并用DeleteFile来删除,再删除其文件夹;
    方案2:
    winexec('Deltree.exe -y '+yourpath,sw_hide);
      

  2.   

    DeleteFile       ////// API, 详见在线帮助。恕我愚昧
      

  3.   

    procedure DeleteFiles (Path, Mask : string; recursive : boolean);
    var
      Result    : integer;
      SearchRec : TSearchRec;
    begin
      if (Copy(Trim(Path),length(Trim(Path)),1) <> '\') then
      Path := Trim(Path) + '\';
      Result := FindFirst(Path + Mask, faAnyFile - faDirectory, SearchRec);
      while Result = 0 do
      begin
        if not DeleteFile (Path + SearchRec.name) then
        begin
          FileSetAttr (Path + SearchRec.name, 0); { reset all flags }
          DeleteFile (Path + SearchRec.name);
        end;
        Result := FindNext(SearchRec);
      end;
      FindClose(SearchRec);  if not recursive then
        exit;  Result := FindFirst(Path + '*.*', faDirectory, SearchRec);
      while Result = 0 do
      begin
        if (SearchRec.name <> '.') and (SearchRec.name <> '..') then
        begin
          FileSetAttr (Path + SearchRec.name, faDirectory);
          DeleteFiles (Path + SearchRec.name + '\', Mask, TRUE);
          RmDir (Path + SearchRec.name);
        end;
        Result := FindNext(SearchRec);
      end;
      FindClose(SearchRec);
    end;