给你一个函数
procedure DoDelTree(TheDir: String);
Var
Search : TSearchRec;
rec : word;
Begin
If TheDir[Length(TheDir)] <> '/' Then TheDir := TheDir + '/';
rec := FindFirst(TheDir + '*.*', faAnyFile, Search);
While rec = 0 Do
Begin
If Search.Name[1] <> '.' Then
Begin
If (Search.Attr And faDirectory) = faDirectory Then
Begin
DoDelTree(TheDir + Search.Name);
RmDir(TheDir + Search.Name);
End
Else
Begin
FileSetAttr(TheDir + Search.Name, 0);
DeleteFile(TheDir + Search.Name);
Application.ProcessMessages;
End;
End;
rec := FindNext(Search);
End;
FindClose(Search);
End;
参数是你要删除的目录名