how can I unpack file "paczka1.zip" to folder ".\kat1" using hb_unzipfile
best regards kajot
kajot
how can I unpack file "paczka1.zip" to folder ".\kat1" using hb_unzipfile
best regards kajot
Dear Kajot,
hb_UnzipFile( "paczka1.zip",, .T.,, ".\kat1" )
FUNCTION hb_UnzipFile( cFileName, bUpdate, lWithPath, cPassword, cPath, acFiles, bProgress )
does hb_UnzipFile works in xHARBOUR
function hb_zipfile work OK
but hb_unzipfile don't unpack files
KAJOT
// -- Testa se pode extrair ou não
IF lExtrai
Result := hb_UnzipFile( cZipFile,, .T.,, pcDestPath, paFile )
ENDIFhttps://fivewin.com.br/index.php?/topic/13548-listar-arquivos-de-um-zipresolvido-aleluia/page/3/
https://forums.fivetechsupport.com/viewtopic.php?f=6&t=30003&p=175748&hilit=hb_UnzipFile#p175748
https://forums.fivetechsupport.com/viewtopic.php?f=6&t=24038&p=129404&hilit=hb+unzipfile#p129404
Regards, saludos.
I am using xHarbour
Result := hb_UnzipFile( cZipFile,, .T.,, pcDestPath, paFile )
it doesn't work
Dear Kajot,
The variable pUnzip is only assigned if parameter 6 is an array or string. But pUnzip is not initialized — if
parameter 6 is missing/NIL, pUnzip has an undefined value, and the code at line 754 (if( pUnzip )) could behave
unpredictably.
More importantly, the 6th parameter (paFile) is mandatory. From the docs:
â–Ž If <cFile> or <aFiles> are not provided, no files will be extracted!
Your call is:
hb_UnzipFile( cZipFile,, .T.,, pcDestPath, paFile )
This looks syntactically correct. The problem could be one of these:
paFile := hb_GetFilesInZip( cZipFile )
Result := hb_UnzipFile( cZipFile,, .T.,, pcDestPath, paFile )
pcDestPath must end with a backslash — the C code uses it directly as a path:
pcDestPath := "C:\MyFolder\" // must end with backslash
The path must already exist — lWithPath (.T.) creates subdirectories within the zip structure, but the destination
folder itself must exist.
File names in paFile must match exactly what's stored in the zip (including paths inside the zip). Check with:
aFiles := hb_GetFilesInZip( cZipFile )
AEval( aFiles, {|c| QOut(c) } )
Antonio
Solucionado... Gracias
vFilXml := hb_GetFilesInZip( cFilZip )
IF LEN(vFilXml) == 0
AADD(aErrZip,{cFilZip,"","Archivo .zip no contiene archivos "})
ELSE
// RUN ("7z x " +cFilZip+ " -o"+ xPatLoc +" -y *.xml -bso0 -bsp0 -bse0" )
hb_UnzipFile( cFilZip,, .T.,, xPatLoc+"\", vFilXml )
cFilXml := ""
for K := 1 to len(vFilXml)
IF Lower(Right(vFilXml[K], 4)) == ".xml"
cFilXml := ALLTRIM(vFilXml[K]) // analiza el primer xml encontrado... no deberian existir mas de uno!!
exit
ENDIF
next
cFilXmlIni := cFilXml
cFilXml := xPatLoc+"\"+cFilXml
IF !fileExiste(cFilXml)
AADD(aErrZip,{cFilZip,cFilXml,"Archivo XML no existe"})
ELSE
//
ENDIFmy sample
sc0 :=curdrive()+':'+'\'+curdir()+'\'
zb:='PaczkaFaktur.zip'
if file(zb)
aFiles := hb_GetFilesInZip( zb , .t.)
AEval( aFiles, {|c| QOut(c) } )
IF LEN(aFiles) > 0
lOK:=hb_UnzipFile( zb,,.T.,, sc0, aFiles)
alert(iif(lOK, "OK", "NO") )
else
alert('Zip nie zawiera plikow.')
endif
else
alert('Brak zbioru '+zb)
endifLook at this
https://forums.fivetechsupport.com/viewtopic.php?p=175748&hilit=hb_UnzipFileRevd#p175748
Marc Vanzegbroeck wrote:Look at this
https://forums.fivetechsupport.com/viewtopic.php?p=175748&hilit=hb_UnzipFileRevd#p175748
Original:
Javier lloris,
https://code.google.com/archive/p/fuentes-javier-lloris/downloads
Many thanks.
Regards, saludos.