<< Click to Display Table of Contents >> Navigation: 3. Script Language > ZIP. - Handle Archives > ZIP-Commands |
MiniRobotLanguage (MRL)
ZIP.compress file
Compress the content of a file
Intention
The ZIP.cf - Command can be used to used to compress the content of a file.
This command will create a Standard ZIP-File that is compatible with the ZIP-Format.
There are generally two ways of usage.
' Give Source- and Target filename
ZIP.cf|$$TXT|$$TAR
or
' ZIP the file and created a ZIP-Filename automatically
$$ZIP=?path\Myfile.txt
ZIP.cf|$$ZIP
' a ZIP-File wit the name "Myfile.zip" is been created in the
' ?path\ folder where the source file was.
You can find out about this constructed filename using the "gtfn" prototype.
§§FIA=?path\Test\Document.ppt
§§FIB=?path\Test\readme.txt
§§FID=?path\Test\Target.zip
Here is a picture how it looks practically.
' Create a new "Document.zip" File
ZIP.cf|§§FIA
This is what we get:
Looking into the File we can see this*:
' Find out the filename of the new Archive
ZIP.gtfn|§§FIA|§§FIX
' §§FIX will be the filename of the new ZIP-Archive
' Now we add a second File into the ZIP-File
ZIP.cf|§§FIB|§§FIX
Now we are going to create a second ZIP-File using the P3 Parameter.
This way we specify the Target-Filename.
' Creat e new ZIP-File §§FID
ZIP.cf|§§FIA|§§FID
' Add a file to §§FID
ZIP.cf|§§FIA|§§FID
The picture also shows that you can have multiple time the same file into a single ZIP-Archive.
Which is a not-recommended feature.
The "cf","zf" and the "uv" command are compatible with standard ZIP-Format.
If the Target-Zip File already exists, the File is added to the ZIP-File.
* We have used "WinRar to look into these files. WinRar is an external Program and not Part of the SPR Distribution.For more Infos on WinRar see
Syntax
ZIP.cf|P2[|P3]
The "cf" and the "uf" command are compatible with standard ZIP-Format.
Parameter Explanation
P1 - "cf" or "compress file"
P2 - Variable with the filename of the file that is to be compressed. If P3 is missing, a ZIP-FIle is been created like this:
ZIP.cf|Myfile.txt
' a ZIP-File wit the name "Myfile.zip" is been created in the
' same folder where the source file was.
You can find out about this filename using the "gtfn" prototype.
P3 - Variable with the target file-name and path.
Example
'***********************************************
' Sample 1: ZIP.
'***********************************************
§§FIA=?path\Document.ppt
§§FIB=?path\readme.txt
§§FID=?path\Target.zip
' Create a new "Document.zip" File
ZIP.cf|§§FIA
' Find out the filename of the new Archive
ZIP.gtfn|§§FIA|§§FIX
' Add a second File into the ZIP-File
ZIP.cf|§§FIB|§§FIX
' Creat e new ZIP-File §§FID
ZIP.cf|§§FIA|§§FID
' Add a file to §§FID
ZIP.cf|§§FIA|§§FID
ENR.
Remarks
The "cf","zf" and the "uf" command are compatible with standard ZIP-Format.
If the Target-Zip File already exists, the File is added to the ZIP-File.
Limitations:
There is a size limitation that depends on the available 32-bit Memory in the WOW64.
Its somewhere between 1 GB and 2 GB.
See also:
• IFZ. / NFZ. - If File in ZIP
• sdk - set default compression