Uncompress

Issues and Discussions related to Harbour

Moderator: Rathinagiri

Post Reply
User avatar
gcarrizo
Posts: 43
Joined: Fri Oct 07, 2016 1:20 pm
DBs Used: DBF
Location: Argentina

Uncompress

Post 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.
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: Uncompress

Post 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
User avatar
gcarrizo
Posts: 43
Joined: Fri Oct 07, 2016 1:20 pm
DBs Used: DBF
Location: Argentina

Re: Uncompress

Post by gcarrizo »

It Work's Perfectly, Thanks

Best Regards

---------------------------------------
Funciona perfectamente, gracias
Saludos.
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Uncompress

Post by edk »

And here is another example using the progress bar.
Attachments
Zip.7z
(2.64 KiB) Downloaded 259 times
User avatar
gcarrizo
Posts: 43
Joined: Fri Oct 07, 2016 1:20 pm
DBs Used: DBF
Location: Argentina

Re: Uncompress

Post 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.
Post Reply