Acoto... para borrar una carpeta incluyendo las sucarpetas debes hacer una funcion recursiva para borrar las carpetas que estén en las carpetas de las carpetas...
Código Delphi
[-]procedure DelTree(Path: string);
var sr: TSearchRec; FileName: string;
begin
if not LongBool(FindFirst(Path + '\*.*', faAnyFile, sr)) then
repeat
FileName := Path + '\' + sr.Name;
if not LongBool(sr.Attr and faDirectory) then
begin
SetFileAttributes(PChar(FileName), FILE_ATTRIBUTE_NORMAL);
DeleteFile(PChar(FileName));
end
else
if (sr.Name <> '.') and (sr.Name <> '..') then
DelTree(FileName);
until LongBool(FindNext(sr));
RemoveDirectory(PChar(FileName));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
DelTree(Edit1.Text);
end;
Así está mejor, pero mucho cuidado!