how can I unpack file "paczka1.zip" to folder ".\kat1" using hb_unzipfile
best regards
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 )
function hb_zipfile work OK
but
hb_unzipfile don't unpack files
KAJOT
Code: Select all | Expand
// -- Testa se pode extrair ou não
IF lExtrai
Result := hb_UnzipFile( cZipFile,, .T.,, pcDestPath, paFile )
ENDIF
https://fivewin.com.br/index.php?/topic ... ia/page/3/
viewtopic.php?f=6&t=30003&p=175748&hili ... le#p175748
viewtopic.php?f=6&t=24038&p=129404&hili ... le#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
Code: Select all | Expand
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
//
ENDIF
my sample
Code: Select all | Expand
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)
endifMarc Vanzegbroeck wrote: Sun Mar 22, 2026 6:33 pmLook at this
viewtopic.php?p=175748&hilit=hb_UnzipFileRevd#p175748
Original:
Javier lloris,
https://code.google.com/archive/p/fuent ... /downloads
Many thanks.
Regards, saludos.
Buena tarde .
vFilXml := hb_GetFilesInZip( cFilZip )
hb_UnzipFile( cFilZip,, .T.,, xPatLoc+"\", vFilXml )
Error en windows server 2022 se aborta, sin mensajes , sin log
windows 10/11 ok perfecto SIN ERROR Y EN PRODUCCION
JONSSON RUSSI
Code: Select all | Expand
#Include "FiveWin.ch"
MEMVAR cDirPleno
FUNCTION Main()
LOCAL cFile, cPathImg
cDirPleno := GETCURDIR()
// Windows Server problems.
IF SUBS( cDirPleno, LEN( ALLTRIM(cDirPleno ) ) , 1 ) = "\"
cDirPleno := SUBS( cDirPleno, 1 , LEN( ALLTRIM(cDirPleno ) ) - 1 )
ENDIF
LCHDIR( cDirPleno )
cPathImg := cDirPleno + "\"+ "*.BMP"
// cFile := CGETFILE( "File Excel (*.xls;*.xlsx)|*.xls;*.xlsx", "Import from", , CURDRIVE() + ":\" + CURDIR() )
cFile := cGetFile( "*.bmp|*.bmp|", "Selecione um Arquivo Bitmap (.BMP)",,"cPathImg" )
IF Empty( cFile )
XImage( cFile )
ENDIF
RETURN NIL
Regards, saludos.