ZIP_FILES Function


Result_Flag as L = zip_files(C zipfilename ,C files_to_zip [,L delete_existing [,N number_of_batches [,C flags [,C base_path ]]]])



The name of the ZIP file to create or to update. Character


A CR-LF or comma, delimited list of filenames. Wildcard characters are supported in filenames.


Determines whether existing files with the same name are deleted.

.T. = The file is deleted (if it exists) before the new file is added to the zip file.

.F. = Files are added to the existing zip file.


Default = 1. The number of batches that the file list should be divided into. Each batch is added to the zip file in a single call to Alpha Anywhere's low level zip function. The fewer the number of batches, the faster the zip operation will be. By setting the Number_of_Batches to 1, the user will get no feedback (other than an hourglass cursor) on the zip operation. If the Number_of_Batches is set to some value greater than 1, then the Status bar will show the percentage of the job that has been completed.


Default = "". Additional flags that indicate the following:


An empty string. The zip file does not include paths of the files that are added.


The path of each file (relative to the Base_Path ) is included in the zip file.


Indicates that the list of input files is CR-LF delimited. Use this flag if there are commas in any of the input filenames.


Default = "". A directory path.


Zips up a CRLF delimited list of files. Wildcards in filenames are supported. For speed, files are combined into batches, and each batch is zipped at once.


ZIP_FILES() is a high level utility function that add a list of files to a zip file called Zip_Filename.

Result_Flag is .T. if all of the files listed in File_List are successfully added to the zip file. If Base_Path is blank, and Flags is "D", then the absolute path of each file is included in the zip file.

This utility function is easier to use than the low level FILE.ZIP()method when you have to add a list of files to a zip file.


The following script adds two files to a zip file.

F1 = "C:\A5\table1.dbf"
F2 = "C:\A5\table2.dbf"
zipfile = "C:\A5\test.ZIP"
filelist = f1 + CRLF() + f2
zip_files(zipfile, filelist, .T.)
ZIP_FILES does not support creating password protected zip archives.

See Also