Uncompress

Issues and Discussions related to Harbour

Moderator: Rathinagiri

Post Reply
User avatar
gcarrizo
Posts: 18
Joined: Fri Oct 07, 2016 1:20 pm
Has thanked: 19 times
Been thanked: 1 time

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: 166
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland
Been thanked: 149 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: 18
Joined: Fri Oct 07, 2016 1:20 pm
Has thanked: 19 times
Been thanked: 1 time

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

It Work's Perfectly, Thanks

Best Regards

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

edk
Posts: 162
Joined: Thu Oct 16, 2014 11:35 am
DBs Used: DBF
Location: Poland
Has thanked: 43 times
Been thanked: 95 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 61 times

User avatar
gcarrizo
Posts: 18
Joined: Fri Oct 07, 2016 1:20 pm
Has thanked: 19 times
Been thanked: 1 time

Post by gcarrizo » Wed Jul 26, 2017 12:55 pm

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