Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Archive.ExtractFile
Extracts one file and returns as container.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Archive | 10.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Archive | Either container with archive or native file path. | "C:\test\test.zip" | |
FilePath | The path name of the file within the archive. Or since version 14.3 the index of the item starting with 0 for the first file. |
"test/test.jpg" | |
Passphrase | Password to use for the archive. | Optional | |
New file name | The new file name to use for container. Default is to use name of the item in the zip archive. |
Optional | |
Options | Available in MBS FileMaker Plugin 14.3 or newer. The options to pass to reader. This is a comma-separated list of options. Option names can be prefixed with module name. |
"hdrcharset=cp1252" | Optional |
Result
Returns container or error.
Description
Extracts one file and returns as container.You may use Archive.FileList to get a list of file names in the archive.
For pure gz file without an archive, you can use Archive.GZipDecompress function.
Examples
Extract one PDF file:
Set Field [ Contacts::Photo Container ; MBS( "Archive.ExtractFile"; "/Users/cs/Desktop/Archiv.zip"; "test40.pdf") ]
Show version number of MBS plugin in Mac container:
# extract info file with metadata
Set Variable [ $InfoFile ; Value: MBS( "Archive.ExtractFile"; Install Plugin Update if needed::Plugin File Mac; "MBS.fmplugin/Contents/Info.plist" ) ]
# get it as text
Set Variable [ $InfoText ; Value: MBS( "Container.GetText"; $InfoFile; "FILE") ]
# query version entry in XML
Set Variable [ $version ; Value: MBS( "XML.GetPathValue"; $InfoText; "plist.dict.string[6]") ]
Show Custom Dialog [ "Version of MBS Plugin" ; $version ]
Extract Mac version number via RegEx:
# extract info file with metadata
Set Variable [ $InfoFile ; Value: MBS( "Archive.ExtractFile"; Install Plugin Update if needed::Plugin File Mac; "MBS.fmplugin/Contents/Info.plist" ) ]
# get version as text
Set Variable [ $version ; Value: MBS( "RegEx.Extract"; $infoText; "<key>CFBundleVersion</key>\s*<string>(.*)</string>"; "\1"; "greedy, caseless" ) ]
Show Custom Dialog [ "MBS Version" ; $version ]
Extract first file:
MBS( "Archive.ExtractFile"; "/Users/cs/Desktop/test.zip"; 0)
See also
- Archive.Extract
- Archive.FileList
- Archive.GZipDecompress
- Container.GetText
- RegEx.Extract
- XML.GetPathValue
Release notes
- Version 14.3
- Added Options parameter for Archive.Content, Archive.Extract, Archive.ExtractFile, Archive.FileList and Archive.GZipDecompress functions.
- Version 10.4
- Added Archive.ExtractFile function.
Example Databases
Blog Entries
- MBS FileMaker Plugin, version 14.3pr7
- Query MBS Version from plugin in container
- What is new in the MBS FileMaker Plugin Version 10.4
- Neues MBS FileMaker Plugin 10.4
- MBS FileMaker Plugin 10.4 - More than 6300 Functions In One Plugin
- MBS FileMaker Plugin, version 10.4pr9
FileMaker Magazin
This function checks for a license.
Created 7th September 2020, last changed 4th July 2024