FILE.ZIP Function


Result_Flag as L = FILE.Zip(C zipfilename,C files[,C zip_flags[,C base_path]])



The name of the zip file to create. If you do not specify an extension, Alpha Anywhere will automatically add the ".ZIP" extension.


Files to add to the zip file. Wildcards are allowed (e.g. " c:\Alpha Anywhere\data\invoices\*.* "). Otherwise, provide a comma, or CR-LF delimited list of file names. If you provide a CR-LF delimited list, you must add ',' to the list of flags.


Default = "" (No paths are stored.) The following flags can be used in the zip command:


Include absolute paths in the zip file.

"base path"

Store paths in the zip file that are relative to the base path.


Indicate that the list of files is CR-LF delimited, not comma delimited. Use this flag if there are commas in any of the filenames.


The base path to store in the zip file.



Returns .T. if the zip file was successfully created, otherwise .F.


Zip files listed - expects a comma separated list.


The FILE.ZIP() method adds a file or files to a zip file called Zip_Filename. If Zip_Filename does not exists it is created. If Zip_Filename already exists, then the files in the File_List are added to the existing zip file. File_List can include wildcard characters.

A zip file is a highly compressed files that contains one or more files. Zip files are ideal for creating backups of your database applications.


For example, the following flag string specifies that the zip file should contain paths that are relative to the "c:\mydata" folder:

FILE.zip(myzip,"c:\mydata\*.*" ,"d","c:\mydata")

Example create a zip file of all of the files in c:\a5data\invoice.


Example create a zip file of all of the files in the current database folder.

path = :a5.get_path()
zip_filename = "backup_data"
'construct full filename - chr(92) is \ character.
full_zip_filename = alltrim(path) + chr(92) + zip_filename
'Check to see if zip file exists. If it does, delete it.
If FILE.exists(full_zip_filename ) then
End if
FILE.zip(full_zip_filename,path + chr(92) + "*.*")
FILE.ZIP does not support creating password protected zip archives.

See Also