Page 1 of 1

Uncompress

Posted: Wed Jul 05, 2017 5:39 pm
by gcarrizo
Is posible extract a single file from a zipfile ?
i try use Uncompress , i read before source example ( \SAMPLES\Miscellaneous\ZIP ) but not found a detailed sintax or
example about it.
Sorry for my English.
Best Regards.

-----------------------------------------

¿Es posible extraer un solo archivo de un archivo zip?
Intentér usar Uncompress, he leído antes de fuente de ejemplo( \SAMPLES\Miscellaneous\ZIP ) , pero no encontré una sintaxis detallada o ejemplo acerca del mismo.

Saludos.

Re: Uncompress

Posted: Wed Jul 05, 2017 7:53 pm
by KDJ
gcarrizo

If MyZipFile.zip contains files:
File1.txt
File2.txt
File3.txt
example how to extract only File2.txt

Code: Select all

#include "hmg.ch"

FUNCTION Main()
  LOCAL cZipFile := "MyZipFile.zip"
  LOCAL cMyFile  := "File2.txt"
  LOCAL pUnzip   := HB_UnzipOpen(cZipFile)
  LOCAL nError
  LOCAL cFile

  IF ! Empty(pUnzip)
    nError := HB_UnzipFileFirst(pUnzip)

    DO WHILE nError == 0
      HB_UnzipFileInfo(pUnzip, @cFile)

      IF cFile == cMyFile
        HB_UnzipExtractCurrentFile(pUnzip, NIL /*cToFile*/, NIL /*cPassword*/)
        EXIT
      ENDIF

      nError := HB_UnzipFileNext(pUnzip)
    ENDDO

    HB_UnzipClose(pUnzip)
  ENDIF

RETURN NIL

Re: Uncompress

Posted: Thu Jul 06, 2017 11:30 am
by gcarrizo
It Work's Perfectly, Thanks

Best Regards

---------------------------------------
Funciona perfectamente, gracias
Saludos.

Re: Uncompress

Posted: Fri Jul 07, 2017 9:45 am
by edk
And here is another example using the progress bar.

Re: Uncompress

Posted: Wed Jul 26, 2017 12:55 pm
by gcarrizo
Gracias por el aporte ... siempre es bueno contar con mas recursos e ideas.
Saludos

edk wrote: Fri Jul 07, 2017 9:45 am And here is another example using the progress bar.