Ver Mensaje Individual
  #11  
Antiguo 03-02-2007
Pedro-Juan Pedro-Juan is offline
Miembro
 
Registrado: ago 2006
Ubicación: Barcelona - España
Posts: 315
Reputación: 18
Pedro-Juan Va por buen camino
Hacer Backup

No necesito cerrar nada, me funciona bien lo siguiente en tiempo de ejecución. Delphi 5, Interbase.

Código Delphi [-]
//Form para la copia
procedure TF_Backup.sBtnCopiarBackupClick(Sender: TObject);//Button copiar
var cFileName,cOrigen,cDestino: String;
begin
F_Backup.sLabel3.Visible := False; //Label de información de copia hecha
cFileName := 'ARCHIVO.GDB'; //Siempre el mismo, no puede cambiar
cOrigen  := Trim(F_Backup.sFilenameEditCopy.Text); //Componente externo a delphi
cDestino := Trim(F_Backup.sDirectoryEditCopy.Text); //Componente externo a delphi
if cDestino <> '' then if not DirectoryExists(cDestino) then MkDir(cDestino);
cDestino := (cDestino + '\' + cFileName);//En esta posición por si no 
                                                       //existía el directorio
  if CopyFile(PChar(cOrigen), PChar(cDestino), False) then begin
     F_Backup.sLabel3.Caption := 'La copia se realizó correctamente'
                                 + #13
                                 + cDestino
                                 + '   '
                                 + DateToStr(Now)
                                 + '   '
                                 + TimeToStr(Time);
     F_Backup.sLabel3.Visible := True;
  end
  else begin
     F_Backup.sLabel3.Visible := False;
     ShowMessage('No se pudo realizar la copia');
  end;
end;

Última edición por Pedro-Juan fecha: 03-02-2007 a las 18:52:09.
Responder Con Cita