Ver Mensaje Individual
  #4  
Antiguo 21-11-2007
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Reputación: 20
cHackAll Va por buen camino
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!
Responder Con Cita