Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5    Statistic  

ZipFile.CreateFile

Creates a new file in the zip archive.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Compression 3.4 Yes Yes Yes Yes Yes

MBS( "ZipFile.CreateFile"; filename; date { ; Comment; Encoding; zip64 } )

Parameters

Parameter Description Example value
filename The filename to use. Can include path information with slashes as delimiter. "myfolder/test.txt"
date The file date to use. Get(CurrentTimestamp)
Comment Optional
The file comment.
"My first file."
Encoding Optional
The text encoding for the comment parameter.
Default is UTF-8.
Possible encoding names: ANSI, Arabic-Mac, Arabic-Win, Baltic-Win, CentralEurope-Mac, ChineseSimp-Mac, ChineseSimp-Win, ChineseTrad-Mac, ChineseTrad-Win, Cyrillic-Mac, Cyrillic-Win, EasternEurope-Win, Greek-Mac, Greek-Win, Hebrew-Mac, Hebrew-Win, ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-15, Korean-Johab, Korean-Mac, Korean-Win, Latin1, Mac, Native, ShiftJIS-Mac, ShiftJIS-Win, Turkish-Mac, Turkish-Win, UTF-8, DOS or Windows. Pass native to use the native encoding of the current platform.
UTF8
zip64 Optional
Pass 1 to enable 64-bit zip file.
Default is 0 for 32-bit zip file.
0

Result

Return OK or error.

Description

Creates a new file in the zip archive.
Use this method before writing data to the file using ZipFile.WriteContainer or ZipFile.WriteTextFile.
Before creating files in archive, you need to open it using ZipFile.Open.
If you want to encrypt file, please use ZipFile.UsePassword before calling this function.

This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.

Examples

Creates a file:

MBS( "ZipFile.CreateFile"; "test.txt"; $date )

See also

Example Databases


ZipFile.CompressFiles   -   ZipFile.Open

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins