Uncompress

Issues and Discussions related to Harbour

Moderator: Rathinagiri

Post Reply
User avatar
gcarrizo
Posts: 7
Joined: Fri Oct 07, 2016 1:20 pm
Has thanked: 11 times

Uncompress

Post by gcarrizo » Wed Jul 05, 2017 5:39 pm

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: 159
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland
Been thanked: 140 times

Post by KDJ » Wed Jul 05, 2017 7:53 pm

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: 7
Joined: Fri Oct 07, 2016 1:20 pm
Has thanked: 11 times

Post by gcarrizo » Thu Jul 06, 2017 11:30 am

It Work's Perfectly, Thanks

Best Regards

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

edk
Posts: 114
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 28 times
Been thanked: 53 times

Post by edk » Fri Jul 07, 2017 9:45 am

And here is another example using the progress bar.
Attachments
Zip.7z
(2.64 KiB) Downloaded 28 times

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests