Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Borrar un directorio completamente (https://www.clubdelphi.com/foros/showthread.php?t=80630)

dec 30-06-2006 23:14:15

Borrar un directorio completamente
 
Procedimiento que borra una carpeta y su contenido:

Código Delphi [-]
procedure DelTree(sPath:String);
Var Fich:TSearchRec;
Begin
  //Evitamos c:\
  If (Length(sPath)=2) And (Right(sPath,1)=':') Then
    Exit;
  If (Right(sPath,1)<>'\') And (sPath<>'') Then
    Try
      If FindFirst(sPath+'\*.*',faAnyFile,Fich)=0 Then
        Repeat
          If (Fich.Attr And faDirectory)>0 Then
          Begin
            If SLeft(Fich.Name,1)<>'.' Then
              DelTree(sPath+'\'+Fich.Name);
          End
          Else
            If Not DelFile(sPath+'\'+Fich.Name) Then
              Error('No puedo borrar el fichero '+Fich.Name,0);
        Until FindNext(Fich)<>0;
    Finally
      SysUtils.FindClose(Fich);
      RemoveDir(sPath);
    End;
End;

mrnovice 02-09-2008 16:31:06

Undeclared Identifier Right, en Delphi 7, acaso soy yo? jeje saludos (y)


La franja horaria es GMT +2. Ahora son las 18:27:06.

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