Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples
New in version: 9.0   9.1   9.2   9.3   9.4   9.5   10.0   10.1   10.2   10.3    Statistic  


Compresses files to an archive.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Archive 9.0 Yes Yes Yes Yes Yes
MBS( "Archive.Compress"; Format; Filter; Destination; BasePath; List { ; Options; Password } )   More


Parameter Description Example value
Format The format to use.
Formats: 7zip, ar, arbsd, argnu, arsvr4, bsdtar, cd9660, cpio, gnutar, iso, iso9660, mtree, mtree-classic, newc, odc, oldtar, pax, paxr, posix, raw, rpax, shar, shardump, ustar, v7tar, v7, warc, xar, zip.
Filter The filter to use.
For zip format can be store or deflate.
Filters: b64encode, bzip2, compress, grzip, gzip, lrzip, lz4, lzip, lzma, lzop, uuencode, xz, zstd.

Not all filters can be combined with all formats.
Destination The native file path to the destinaton archive.
Or file name for container.
BasePath The bath path to the folder where to look for files. "C:\test"
List the list of files and folders to add to archive. "test.txt"
Options Optional
The options to pass to writer.
This is a comma-separated list of options. Option names can be prefixed with module name.

Sample options:
Password Optional
The passphrase to use for password protection.


Returns OK or error.


Compresses files to an archive.
Supports various compression algorithms and encryption.
The archive usually should not contain the absolute paths of the files, so we need a base path and relative to that base path the list of files and folders to zip.


Compression examples:

# list of files in the folder to archive
Set Variable [ $list ; Value: "minitar.c¶simplebar.rbp" ]

# write zip file with password
Set Variable [ $r ; Value: MBS( "Archive.Compress"; "zip"; "deflate"; "/Users/cs/Desktop/"; "/Users/cs/Desktop/"; $list; "zip:encryption=zipcrypt"; "secret password" ) ]

# Write bzip2 compress tar file:
Set Variable [ $r ; Value: MBS( "Archive.Compress"; "ustar"; "bzip2"; "/Users/cs/Desktop/minitar.tar"; "/Users/cs/Desktop/") ]

# and write zip with aes encryption to container file:
Set Variable [ $r ; Value: MBS( "Archive.Compress"; "zip"; "deflate"; ""; "/Users/cs/Desktop/"; $list; "zip:encryption=aes128"; "secret password" ) ]
Set Field [ Archive Read::Container ; $r ]

Compress with UTF-8 file names:

MBS( "Archive.Compress"; "zip"; "deflate"; "C:\Users\Christian\Desktop\"; "C:\Users\Christian\Desktop"; "Bücher"; "hdrcharset=UTF-8" )

See also

Blog Entries

Release notes

Created 17th December 2018, last changed 9th December 2019

Applescript.DeterminePermissionToAutomateTarget   -   Archive.Content

Feedback: Report problem or ask question.

MBS FileMaker blog