by ADBLANCO » Fri Jan 25, 2008 4:55 pm
Agarra este trompo en la uña (Dicho Venezolano)
*******************************************************************************
static procedure GrabaZip(cOrig,aFileList)
*******************************************************************************
local cFile ,;
aFiles,;
nItem,;
cString,;
cReturn:="",;
nI,;
na,;
aFil,;
cFilepath,;
lContinue
cFile:=cGetFile( "*.zip","Seleccione Archivo a Exportar" )
if len(alltrim(cFile))<>0
lContinue:=.t.
if file(cfile)
if !MsgNoYEs("Archivo Ya Existe, Desea Sobre-Escribir","Exportar")
lContinue:=.f.
endif
endif
if lContinue
cursorwait()
cFilePath := AllTrim( cOrig )
for nI=1 to len(aFilelist)
cReturn += AllTrim( cOrig ) +aFilelist[nI]
next
cString := cReturn
aFiles := {}
for nI=1 to len(aFilelist)
aFil := Directory( ( cFilePath +aFilelist[nI] ) )
//aEval( aFil, { | uFile | AAdd( aFiles, uFile ) } )
for na=1 to len(afil)
AAdd( aFiles, afil[na,1] )
next
next
// HB_ZipFile( <cFile>, <cFileToCompress> | <aFiles>, <nLevel>, <bBlock>, <lOverwrite>, <cPassword>, <lWithPath>, <lWithDrive>, <pFileProgress> )
// cFile: filename of the zip file.
// cFileToCompress | aFiles: a file or a list (array) of files to compress.
// nLevel: compression level (value from 0 to 9).
// Block: code block to execute while compressing.
// lOverWrite: overwrite existing files or not.
// cPassword: password to encrypt the files.
// lWithPath: store the file path or not.
// lWithDrive: store the drive letter and path or not.
// pFileProgress: code block for file progress.
HB_ZIPFILE( cfile, afiles,,,,, .t. )
cursorarrow()
*wqout( HB_GetFilesInZip( cfile ) )
endif
endif
return
*******************************************************************************
static procedure LeeZip()
*******************************************************************************
local cFile ,;
aFiles,;
nItem
cFile:=cGetFile( "*.zip","Seleccione Archivo a Importar" )
if len(alltrim(cFile))<>0
if msgnoyes('Archivos en el Sistema Seran Sustituidos, Desea Continuar',"Importar")
aFiles :=HB_GetFilesInZip( cFile )
HB_UNZIPFILE( cFile, { | x, y | QOUT( "Archivo ", STR( y, 1 ), " se está extrayendo." ) },,, '.\', aFiles )
//for nItem:=1 to len( aFiles )
// HB_UNZIPFILE( "Angelito.zip", { | x, y | QOUT( "Archivo ", STR( y, 1 ), " se está extrayendo." ) },,, '.\', aFiles[ nItem ] )
// next
delfile('','*.cdx')
MsgMeter( { | oMeter, oText, oDlg | reindexa(oMeter, oText, oDlg)} )
n_use('Acceso','=',exclusivo,0)
endif
endif
return
// oMeter:nTotal :=len( aPrint )*oNomina:nCopias
// oMeter:nRefresh :=Int( oMeter:nTotal/100 )
// if oMeter:nRefresh<1
// oMeter:nRefresh :=1
// endif
y encadenas la siguiente librería:
hbzip.lib
Suerte!