HB_ZipFile() & HB_UnZipFile()

Source code related resources

Moderator: Rathinagiri

User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 411 times
Been thanked: 120 times
Contact:

Re: HB_ZipFile() & HB_UnZipFile()

Post by esgici »

mustafa wrote:
Fri Mar 15, 2019 1:45 pm
Hello friends
We are still experimenting with the ZIP theme
Here you have a new delivery based on the sample
previous with some modifications in the Source Code
and an expansion in the Options Menu
Watch the sample, if it may interest you? :idea:
Regards
Mustafa
Thanks Mustafa :)
Viva INTERNATIONAL HMG :D

User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia
Has thanked: 16 times
Been thanked: 11 times

Post by hmgchang »

Hola Masters,
1. How to add/update files into existing zip file?

I backup files in zipfile, and only want to update only the changed files. Using hb_zipopen () will erase all the files in zip making the zipfile size to 0byte.

I cant find any function to open for append/update.
Pls advise n thanks a lot

Thks n rgd
Chang
Just Hmg It !

edk
Posts: 706
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 193 times
Been thanked: 647 times

Post by edk »

HB_ZIPFILE:HB_ZIPFILE()
Create a zip file
Syntax
HB_ZIPFILE( <cFile> , <cFileToCompress> | <aFiles>, <nLevel> , <bBlock>,<lOverWrite> ,<cPassword>,<lWithPath>,<lWithDrive>) ---> lCompress

Arguments
<cFile> Name of the zip file
<cFileToCompress> Name of a file to Compress, Drive and/or path can be used
<aFiles> An array containing files to compress, Drive and/or path can be used
<nLevel> Compression level ranging from 0 to 9
<bBlock> Code block to execute while compressing
<lOverWrite> Toggle to overwite the file if exists
<cPassword> Password to encrypt the files
<lWithPath> Toggle to store the path or not
<lWithDrive> Toggle to store the Drive letter and path or not

Returns
<lCompress> .t. if file was create, otherwise .f.

Description
This function creates a zip file named <cFile>. If the extension is ommited, .ZIP will be assumed. If the second parameter is a character string, this file will be added to the zip file. If the second parameter is an array, all file names contained in <aFiles> will be compressed.
If <nLevel> is used, it detemines the compression type where 0 means no compression and 9 means best compression.
If <bBlock> is used, every time the file is opened to compress it will evaluate bBlock. Parameters of bBlock are cFile and nPos.
If <lOverWrite> is used , it toggles to overwrite or not the existing file. Default is to overwrite the file,otherwise if <lOverWrite> is false the new files are added to the <cFile>.
If <cPassword> is used, all files that are added to the archive are encrypted with the password.
If <lWithPath> is used, it tells thats the path should also be stored with the file name. Default is false.
If <lWithDrive> is used, it tells thats the Drive and path should also be stored with the file name. Default is false.

User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia
Has thanked: 16 times
Been thanked: 11 times

Post by hmgchang »

This Mr. EDK....
I will try.

Thks n Eyes
Chang
Just Hmg It !

User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia
Has thanked: 16 times
Been thanked: 11 times

Post by hmgchang »

Hola Masters,

i tried hb_zipfile() and found :

1. With the lOverWrite set to .F., we may have two/more same filename in the zipfile.

2. It always create a new zipfile, this prevent us from adding files into an existing zipfile. ( this is my question is about).

3. It does not include subdir in the zipfile

4. It support the wildcard *.*

So,.. i still need any suggestion on how to add files to an existing zipfile without erasing the existing-files in the zipfile.

thks n rgds
Chang
Just Hmg It !

Post Reply