Create Zip (script step reference)

Troi File Plug-in for FileMaker Pro

Create Zip

Create a ZIP file, from the specified file or folder.

SyntaxScript step badge

Create Zip [ Select ; Result (error) ; Source path ; Destination Zip file ;
Timeout ]


Select entire contentsreplaces the contents of a field with the result. If not checked the result replaces the currently selected portion of the field
Result (error)an error code
Source paththe path to the source file or folder to be zipped
Destination Zip filethe path to the new ZIP file to be created
Timeout(optional) specify the timeout time in seconds (default = 20 seconds)

Returned Result

Data type returned

Error code


The returned result is an error code. An error always starts with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:

0no errorThe ZIP file was created
$$-43fnfErrSource file not found
$$-48dupFNErrDestination ZIP file already exists
$$-4230timeoutErrThe creation of the ZIP timed out

Other errors may be returned.

Originated in

Troi File Plug-in 9.0


FileMaker Pro 16 to 17


You can zip a single file or a complete folder, including subfolders and all items contained in the folder.
Zipping many items can take a long time. With the Timeout option you can increase the timeout time so it is long enough.


Create Zip [ Select ; $ErrorCode ; "C:\dataDir\" ; "D:\" ]

This will create a compressed ZIP file archive with the contents of the folder dataDir.

Example 2

We assume that in your FileMaker file the following fields are defined and filled with the paths to the source and destination ZIP file:

 this::sourcePath             may contain something like "MacHD:Users:kip:bigtext.doc" 
 this::destinationZIPPath	 may contain something like ""

This example will first set the variables from the paths stored in the two fields, and then create the ZIP file.
In a script add the following steps:

# Initialize: copy the fields into variables first:
Set Variable [ $SourcePath ; this::sourcePath ]
Set Variable [ $DestinationZIP ; this::destinationZIPPath ]
# Now zip it:
CreateZip [ Select ; $ErrorCode ; $SourcePath ; $DestinationZIP ; Timeout: 60 ]

This will create the zip file. If the step takes longer than 60 seconds the step is aborted and the plug-in will return with a timeout error $$-4230.

Related script stepsScript step badge

Create File

Related functionsFunction badge


Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 13 to 17 –> Create Zip (filep7303) 2018-0515 15:33:56