<< Click to Display Table of Contents >> Navigation: 3. Script Language > ZIP. - Handle Archives > ZIP-Commands |
MiniRobotLanguage (MRL)
ZIP. Command
Compress or uncompress Files / Archives
Intention
The ZIP.-Command can be used to compress or uncompress files or folders to or from a ZIP-File. It can be used to extract files from a Standard ZIP-files that has been created using another ZIP-Tool.
Possible Uses:
You can add a single ZIP-FIle to your Executable and unzip it at RunTime.
Or download a ZIP-File from WEB and unpack it at Runtime.
You can have zipped Archives on a network share and load and install them on clients in your network.
ZIP. can be used to extract Archives with Folders and files.
ZIP. can be used to compress complete foiders into a single ZIP-File.
ZIP. can be used to compress and uncompress Text-Data that is available in a variable.
Limitations:
ZIP. can be used to compress complete folders into a single ZIP-File.
In this case, empty Sub-Folders are ignored and not included in the archive.
ZIP. can be used to compress and uncompress Text-Data that is available in a variable.
In this case the result is in a own format, and therefore not compatible with any unzip, other then the ZIP.-Command itself.
Note that you can split very large files using these commands before "Zipping" them:
• FIL.Join File and
Its recommended that you turn the builtin compression in the FIL.Split File command off, before using ZIP on these files. Otherwise the ZIP compression can not be effective because these files would already be compressed.
Syntax
ZIP.P1|P2[|P3][|P4][|P5]
Change Settings etc.:
"sdc", "set default compression" - used to set the compression / speed ratio for all compress-operations. The Ratio is been set using a numeric value between 0 and 10.
0 -> use default compression
1 -> no compression
10 -> maximum compression
"gtfn","get zip filename" - used to create a filename with the ending ".zip" from another filename or foldername.
Listing.txt -> Listing.zip
Pack and Unpack Zipped Archives:
"zf","zip folder" - used to compress a complete folder with all subfolders into a single "zip"-Archive. The ZIP-File is compatible to any standard ZIP-Tool. Any empty Folders in teh Source folder will be ignored.
ZIP.zf|$$FOL[|...P5]
"cf","compress file" - used to create a file with the ending ".zip" from another filename.
Will automatically generate the Target Filename. If the Target "zip"-File exists, the File is added to that archive. Note that ZIP-Archives can hold multiple times the same filename, therefore Files inside the Archive are not overwritten if you add a file with the same name.
Unlike "cftf" will only take one Parameter:
ZIP.cf|$$FIL
ZIP.cf|C:\File.txt|c:\File.zip
"uf","unzip file" - uncompress / unzip a ZIP-File to a destination folder. Can be used to uncompress complete ZIP-Archives including all Subfolders. Generally the folder-structure of the ZIP-Archive is preserved, with the exception that empty folders, from inside the zip-file are ignored. Is the unpack command for both of the above commands "zf" and "cf".
ZIP.uf|$$FIL|?path\Extracted_Zip\
(Un-)Compress Data:
"cv","compress var" - used to compress the content of a Variable. The result van be uncompressed only using "uv". The result is not compatible with the standard "zip" Format.
"uv","uncompress var" - used to uncompress the content of a Variable. The source must have been compressed using "cv". The command is not compatible with the standard "zip" Format.
"deb","debug exe" - this is a special case that takes no parameter. Called from an compiled executable, it will ZIP the actual Runtime-Folder, and place it as a file named "Debug.zip" on the common desktop.
' Its a shortcut for this:
§§FIF=?path\
§§FIB=?cdesktop\Debug.zip
ZIP.zf|§§FIF|§§FIB|*.*|sho
Parameter Explanation
P1 - Prototype, one from, the following:
P2 - P4 Parameter depending on Type of Operation
Example
'***********************************************
' Sample: ZIP.
'***********************************************
'
$$FIL=?path\readme.txt
CFF.$$FIL|$$TXT
FOR.§§LOP|0|10
ZIP.sdc|§§LOP
DBP.Compression is §§LOP
CFF.$$FIL|$$TXT
LEN.$$TXT|$$LEA
DBP.Original=$$LEA
$$TIA=#dtime#
ZIP.cv|$$TXT|$$TAR
$$TIB=#dsince#
CAL.$$TIT=$$TIB|r
LEN.$$TAR|$$LEB
DBP.Compressed=$$LEB / Time: $$TIT sec.
ZIP.uv|$$TAR
LEN.$$TAR|$$LEC
DBP.UnCompressed=$$LEC
NEX.
ENR.
Remarks
I get these3 values:
Original=94580480 Bytes
default Compression is 0
Compressed=590448 / Time: 1.37 sec.
Compression is 1
Compressed=94594916 / Time: 1.22 sec.
Compression is 2
Compressed=2764314 / Time: .85 sec.
Compression is 3
Compressed=2355309 / Time: .89 sec.
Compression is 4
Compressed=2394226 / Time: .89 sec.
Compression is 5
Compressed=1258712 / Time: 1.39 sec.
Compression is 6
Compressed=622451 / Time: 1.38 sec.
Compression is 7
Compressed=590448 / Time: 1.34 sec.
Compression is 8
Compressed=560951 / Time: 1.4 sec
Compression is 9
Compressed=552086 / Time: 1.36 sec.
Compression is 10
Compressed=552086 / Time: 1.41 sec.
Limitations:
ZIP. can be used to compress complete foiders into a single ZIP-File.
In this case, empty Sub-Folders are ignored and not included in the archive.
ZIP. can be used to compress and uncompress Text-Data that is available in a variable.
In this case the result is not compatible with any unzip other then the ZIP.-Command here in the SPR.
See also:
• sdk - set default compression
• IFZ. / NFZ. - If File in ZIP