Respaldo de archivos
Posted: Sat Oct 06, 2018 2:48 am
Amigos del foro
Creo por ahi en el foro encontré unas rutinas para el respaldo de archivos
Codigo de Buidx.bat
Este otro archivo es llamado por builx.bat
imagen
https://imgur.com/a/FubIvVQ
En xHarbour hay algun equivalente para las funciones de HB_ZIPFILE, HB_GETFILESINZIP Y HB_UNZIPFILE ?
Mi archivo prg
De antemano muchas gracias
Creo por ahi en el foro encontré unas rutinas para el respaldo de archivos
Codigo de Buidx.bat
Code: Select all
@ECHO OFF
CLS
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ FiveWin for xHarbour 13.01 - Jan. 2013 xHarbour development power ³Ü
ECHO ³ (c) FiveTech, 1993-2013 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8 ³Û
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ECHO ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
if A%1 == A GOTO :SINTAX
if NOT EXIST %1.prg GOTO :NOEXIST
ECHO Compiling...
if "%FWDIR%" == "" set FWDIR=p:\32bits\13.01\fwh
if "%XHDIR%" == "" set XHDIR=p:\32bits\13.01\xharbour
rem if "%2" == "/b" set GT=gtwin
rem if not "%2" == "/b" set GT=gtgui
set GT=gtgui
set hdir=%XHDIR%
set hdirl=%hdir%\lib
set bcdir=p:\32bits\borland\bcc582
set fwh=%FWDIR%
%hdir%\bin\harbour %1 /n /i%fwh%\include;%hdir%\include /w /p %2 %3 > comp.log
IF ERRORLEVEL 1 GOTO COMPILEERRORS
@type comp.log
echo -O2 -e%1.exe -I%hdir%\include -I%bcdir%\include %1.c > b32x.bc
%bcdir%\bin\bcc32 -M -c -v @b32x.bc
:ENDCOMPILE
IF EXIST %1.rc %bcdir%\bin\brc32 -r -I%bcdir%\include %1
echo %bcdir%\lib\c0w32.obj + > b32x.bc
echo %1.obj, + >> b32x.bc
echo %1.exe, + >> b32x.bc
echo %1.map, + >> b32x.bc
echo %fwh%\lib\Fivehx.lib %fwh%\lib\FiveHC.lib + >> b32x.bc
echo %hdirl%\rtl.lib + >> b32x.bc
echo %hdirl%\vm.lib + >> b32x.bc
echo %hdirl%\%GT%.lib + >> b32x.bc
echo %hdirl%\lang.lib + >> b32x.bc
echo %hdirl%\macro.lib + >> b32x.bc
echo %hdirl%\rdd.lib + >> b32x.bc
echo %hdirl%\dbfntx.lib + >> b32x.bc
echo %hdirl%\dbfcdx.lib + >> b32x.bc
echo %hdirl%\dbffpt.lib + >> b32x.bc
echo %hdirl%\hbsix.lib + >> b32x.bc
echo %hdirl%\debug.lib + >> b32x.bc
echo %hdirl%\common.lib + >> b32x.bc
echo %hdirl%\pp.lib + >> b32x.bc
echo %hdirl%\pcrepos.lib + >> b32x.bc
echo %hdirl%\ct.lib + >> b32x.bc
echo %hdirl%\zlib.lib + >> b32x.bc
rem echo %hdirl%\hbzip.lib + >> b32x.bc
echo %hdirl%\libmisc.lib + >> b32x.bc
echo %hdirl%\tip.lib + >> b32x.bc
echo %hdirl%\png.lib + >> b32x.bc
rem Uncomment these two lines to use Advantage RDD
rem echo %hdir%\lib\rddads.lib + >> b32x.bc
rem echo %hdir%\lib\Ace32.lib + >> b32x.bc
echo %bcdir%\lib\cw32.lib + >> b32x.bc
echo %bcdir%\lib\import32.lib + >> b32x.bc
echo %bcdir%\lib\uuid.lib + >> b32x.bc
echo %bcdir%\lib\ws2_32.lib + >> b32x.bc
echo %bcdir%\lib\psdk\odbc32.lib + >> b32x.bc
echo %bcdir%\lib\psdk\rasapi32.lib + >> b32x.bc
echo %bcdir%\lib\psdk\nddeapi.lib + >> b32x.bc
echo %bcdir%\lib\psdk\msimg32.lib + >> b32x.bc
echo %bcdir%\lib\psdk\psapi.lib + >> b32x.bc
echo %bcdir%\lib\psdk\gdiplus.lib + >> b32x.bc
echo %bcdir%\lib\psdk\iphlpapi.lib, >> b32x.bc
IF EXIST %1.res echo %1.res >> b32x.bc
rem uncomment this line to use the debugger and comment the following one
if %GT% == gtwin %bcdir%\bin\ilink32 -Gn -Tpe -s -v @b32x.bc
IF ERRORLEVEL 1 GOTO LINKERROR
if %GT% == gtgui %bcdir%\bin\ilink32 -Gn -aa -Tpe -s -v @b32x.bc
IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * Application successfully built *
%1
GOTO EXIT
ECHO
rem delete temporary files
@del %1.c
:COMPILEERRORS
@type comp.log
ECHO * Compile errors *
GOTO EXIT
:LINKERROR
ECHO * Linking errors *
GOTO EXIT
:SINTAX
ECHO SYNTAX: Build [Program] {-- No especifiques la extensi¢n PRG
ECHO {-- Don't specify .PRG extension
GOTO EXIT
:NOEXIST
ECHO The specified PRG %1 does not exist
:EXIT
Code: Select all
p:\32bits\borland\bcc582\lib\c0w32.obj +
resarc.obj, +
resarc.exe, +
resarc.map, +
p:\32bits\13.01\fwh\lib\Fivehx.lib p:\32bits\13.01\fwh\lib\FiveHC.lib +
p:\32bits\13.01\xharbour\lib\rtl.lib +
p:\32bits\13.01\xharbour\lib\vm.lib +
p:\32bits\13.01\xharbour\lib\gtgui.lib +
p:\32bits\13.01\xharbour\lib\lang.lib +
p:\32bits\13.01\xharbour\lib\macro.lib +
p:\32bits\13.01\xharbour\lib\rdd.lib +
p:\32bits\13.01\xharbour\lib\dbfntx.lib +
p:\32bits\13.01\xharbour\lib\dbfcdx.lib +
p:\32bits\13.01\xharbour\lib\dbffpt.lib +
p:\32bits\13.01\xharbour\lib\hbsix.lib +
p:\32bits\13.01\xharbour\lib\debug.lib +
p:\32bits\13.01\xharbour\lib\common.lib +
p:\32bits\13.01\xharbour\lib\pp.lib +
p:\32bits\13.01\xharbour\lib\pcrepos.lib +
p:\32bits\13.01\xharbour\lib\ct.lib +
p:\32bits\13.01\xharbour\lib\zlib.lib +
p:\32bits\13.01\xharbour\lib\libmisc.lib +
p:\32bits\13.01\xharbour\lib\tip.lib +
p:\32bits\13.01\xharbour\lib\png.lib +
p:\32bits\borland\bcc582\lib\cw32.lib +
p:\32bits\borland\bcc582\lib\import32.lib +
p:\32bits\borland\bcc582\lib\uuid.lib +
p:\32bits\borland\bcc582\lib\ws2_32.lib +
p:\32bits\borland\bcc582\lib\psdk\odbc32.lib +
p:\32bits\borland\bcc582\lib\psdk\rasapi32.lib +
p:\32bits\borland\bcc582\lib\psdk\nddeapi.lib +
p:\32bits\borland\bcc582\lib\psdk\msimg32.lib +
p:\32bits\borland\bcc582\lib\psdk\psapi.lib +
p:\32bits\borland\bcc582\lib\psdk\gdiplus.lib +
p:\32bits\borland\bcc582\lib\psdk\iphlpapi.lib,
https://imgur.com/a/FubIvVQ
En xHarbour hay algun equivalente para las funciones de HB_ZIPFILE, HB_GETFILESINZIP Y HB_UNZIPFILE ?
Mi archivo prg
Code: Select all
/*
Compresion / descompresion de ficheros ZIP desde Harbour
(c) 2009 Biel Maimo bmaimo@gmail.com - bielsys.blogspot.com
*/
#include "FiveWin.ch"
#include "Directry.ch"
STATIC cDirLocal
FUNCTION ResArc()
LOCAL cFile,aFile, aFileBck:={}
cDirLocal:=cFilePath( GetModuleFileName( GetInstance() ) )
cFile:='datos.zip'
aFile:=Directory('*.*') //Todos los ficheros de la capeta donde se ejecuta nuestro ejemplo
AEval(aFile,{|a|AAdd(aFileBck,cDirLocal+a[F_NAME])}) //Añado path a los nombre de archivo
Comprime( @cFile, aFileBck )
DesComprime( cFile )
RETURN NIL
//---------------------------------------
STATIC FUNCTION Comprime(cFile,aFile)
LOCAL oDlg,oMeter,oText,cMsg,nLen,lVal,nActual:=0
nLen:=Len(aFile)
DEFINE DIALOG oDlg FROM 1, 1 TO 10, 60 TITLE "Espere comprimiendo archivos..."
@ 0.5, 2 SAY oText VAR cMsg SIZE 180, 20 OF oDlg
@ 2, 2 METER oMeter VAR nActual TOTAL 100 OF oDlg SIZE 200, 20
oDlg:bStart:={||lVal:=Hb_ZIPFILE(cFile,aFile, 9,{|cFile,nPos|oText:SetText('Comprimiendo '+cFile),;
nActual:=nPos/nLen*100,oMeter:Set(nActual)},.t.,,.t.,.t. ),;
IF(lVal,MsgInfo('Compresión completada con éxito'+CRLF+CRLF+;
'Fichero guardado '+cFile,'Bielsys 2009'),;
MsgStop('No pudo realizarse la compresión')),;
oDlg:END()}
ACTIVATE DIALOG oDlg CENTERED
RETURN lVal
//----------------------------------
STATIC FUNCTION Descomprime(cFile)
LOCAL oDlg,nFiles,oText, cMsg, oMeter,nActual:=0
nFiles:=Len(hb_GetFilesInZip(cFile))
DEFINE DIALOG oDlg FROM 1, 1 TO 10, 60 TITLE "Espere ejecutando recuperación de datos..."
@ 0.5, 2 SAY oText VAR cMsg SIZE 180, 20 OF oDlg
@ 2, 2 METER oMeter VAR nActual TOTAL 100 OF oDlg SIZE 200, 20
oDlg:bStart:={||lVal:=Hb_UnZipFile(cFile,{|cFile,nPos|oText:SetText('Descomprimiendo'+CRLF+cFile),;
nActual:=nPos/nFiles*100,oMeter:Set(nActual)},,,cFile), ;
IF(lVal,MsgInfo('Restauracion completada con éxito'+CRLF+CRLF,'Bielsys 2009'),;
MsgStop('No se han podido restaurar los datos')),;
oDlg:END()}
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL