Compresses the file(s) found at the path file. If the archive parameter is not specified, then the zip file is put into the same folder as file and has the .zip extension appended to the filename. This will overwrite an existing file if it exists with that name already.
- filePathList : a system file path. Or a return separated list of paths to files. Or a container field.
- archiveFilePath : the full path to the archive output file. Will overwrite any existing file.
- 1.3.0 : Added.
- 2.0.0 : Bug Fixes
- 2.2.0 : added the archiveFilePath parameter
- 2.3.0 : modified the file parameter to allow a list of file paths, instead of a single file/folder.
- 3.0.0 : improved error handling, create empty directories in archives
- 4.1.3 : don't crash when there's nothing to archive. return an error if more than one file with the same name is added to the archive
- 4.2.0 : added the option to allow filePathList to be a container field.
- the zip file format doesn't have a provision for adding files of the same name. So if you run :BE_Zip ( List ( "myfile.txt" ; "folder/myfile.txt" ) )
- then it will store both files in the zip, BUT when you unzip the second file will overwrite the first one. This is a limitation of the zip format, not a plugin limitation.
Example : you have 2 files in the documents folder called file1.pdf and file2.pdf that you want to add to a zip called archive.zip in the same folder. You need to convert the docs path into a plugin path first, and then do :
Let ( [
path = ConvertFromFileMakerPath ( Get ( DocumentsPath ) ; PosixPath ) ;
pathlist = List ( path & "file1.pdf" ; path & "file2.pdf" ) ] ;
BE_Zip ( pathlist ; path & "archive.zip" )