Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros temas > Trucos
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Los mejores trucos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 07-06-2006
Avatar de Emilio
*Emilio* Emilio is offline
Capo
 
Registrado: may 2003
Ubicación: Palma de Mallorca
Posts: 2.635
Poder: 10
Emilio Va por buen camino
Borra un directorio completo

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;
Responder Con Cita
  #2  
Antiguo 11-10-2007
Montero Montero is offline
Registrado
 
Registrado: oct 2007
Posts: 2
Poder: 0
Montero Va por buen camino
Otra vez yop...

En este código me manda el siguiente error:

If (Length(sPath)=2) And (Right(sPath,1)=':') Then

error : Undeclared identifier: 'Right'

Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 12:22:59.


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
Copyright 1996-2007 Club Delphi