Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Simular un Deltree. Borrar un directorio y todo su contenido (https://www.clubdelphi.com/foros/showthread.php?t=80644)

dec 30-06-2006 23:35:08

Simular un Deltree. Borrar un directorio y todo su contenido
 
Código Delphi [-]
var
   search: TSearchRec;
   nFiles: integer;
begin
     nFiles:=FindFirst( cPath + '\*.*', faAnyFile,  search );
     while nFiles=0 do
     begin
          if Search.Attr = faDirectory then
          begin
               if (Search.Name<>'.') and (Search.Name<>'..') then
               begin
                    Deltree( cPath + '\' + Search.Name );
                    RMDir( cPath + '\' + Search.Name );
               end;
          end
          else
              SysUtils.DeleteFile(cPath + '\' + Search.Name);
          nFiles:=FindNext( Search );
     end;
     FindClose(Search);
     RMDir(cPath);
end;


La franja horaria es GMT +2. Ahora son las 19:26:52.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi