From WikiChip
Editing mirc/identifiers/$zip
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
{{mirc title|$zip Identifier}}'''$zip''' creates/tests/extracts/lists zip using optional AES-256 encryption | {{mirc title|$zip Identifier}}'''$zip''' creates/tests/extracts/lists zip using optional AES-256 encryption | ||
− | |||
− | |||
== Synopsis == | == Synopsis == | ||
− | <pre> | + | <pre>$zip(file.zip,<c|e|t|l>[po],file|dir|N [,password])[.size] |
− | $zip(file.zip,c[po], | + | $zip(file.zip,c[po],file|dir added [,password]) |
$zip(file.zip,l,N)[.size] | $zip(file.zip,l,N)[.size] | ||
$zip(file.zip,t[p,password]) | $zip(file.zip,t[p,password]) | ||
− | $zip(file.zip,e[po], | + | $zip(file.zip,e[po],ExtractDir [,password]) |
</pre> | </pre> | ||
+ | == Parameters == | ||
+ | * '''file.zip''' = filename used to create the .zip (or overwrite existing file when using o switch) | ||
+ | * '''cetpol''' = see valid switches below | ||
+ | * '''file|dir''' = different meaning in different c|e|l contexts: | ||
+ | ** when c switch used, if this is a filename, this is the 1 file to be added without including path. Wildcards not accepted. If this is a foldername, the contents of that folder and any subfolders are added to file.zip with relative path beginning with "dirname\" | ||
+ | ** When e switch used, is the destination FOLDER for extraction of all contents of file.zip. | ||
+ | ** When l switch is used, this is the filename.zip whose contents are listed (listed items can be filenames or foldernames) | ||
+ | ** When 't' switch is used, does not permit using the file|dir parameter | ||
+ | '''N = 0''' lists the total number of items | ||
+ | '''N > 0''' returns the Nth item inside the zip | ||
+ | * password = password used to encrypt each file added to zip. Can contain spaces. Valid only when using the 'p' switch. | ||
+ | Note: when 't' testing the .zip, the file|dir parameter is not present, and 'p' causes the 3rd parameter to be seen as password<br /> | ||
+ | Note: the password is valid but ignored when 't' tests or 'e' extracts files which had not been encrypted | ||
− | == | + | == Switches == |
− | * | + | * c = create zip |
− | * | + | * l = list zip contents (N=0 is total items, N>0 is the Nth item) .size prop lists filesize instead of filename) items ending with "\" are foldernames whose .size is zero) |
− | * | + | * e = extract from zip |
+ | * p = password | ||
+ | * t = test zip contents | ||
+ | * o = overwrite extraction dir & contents (required if extraction dir exists) | ||
− | + | Returns 1=success 0=fail except when 'l'isting | |
− | |||
− | |||
− | |||
− | * '' | + | * Warning: Using the 'o' switch when extracting should NOT be used when extracting into $mircdir or any folder having important files in that folder or in any subfolders below it, especially if the zip was not created by YOU. The 'o' switch is required when extracting into an existing foldername, even if empty. However it also results in overwriting extracted contents on top of existing filenames or path\filenames relative to the parent folder of the folder being extracted into. |
− | |||
− | |||
− | |||
+ | Note: If .zip contains a potentially dangerous filename such as containing '../' then 'e' and 'l' report 0 and refuse to extract or list contents. | ||
== Properties == | == Properties == | ||
− | + | .size = alters 'l' output to return the Nth item's filesize instead of its filename (If the Nth item is a foldername, returns 0) | |
− | + | None | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Example == | == Example == | ||
Line 81: | Line 81: | ||
Note: If the password is missing/wrong for a file inside the zip, any foldernames in the zip are created. | Note: If the password is missing/wrong for a file inside the zip, any foldernames in the zip are created. | ||
− | Create logs.zip containing contents of logs subfolder beneath $mircdir, returns 1 if successful | + | Create logs.zip containing contents of logs subfolder beneath $mircdir, returns 1 if successful |
− | |||
//echo -a $zip(logs.zip,c,logs) | //echo -a $zip(logs.zip,c,logs) | ||
− | |||
<source lang="mIRC"> | <source lang="mIRC"> | ||
− | |||
− | |||
List contents of logs.zip: | List contents of logs.zip: | ||
− | //var %i 1 | while ($zip(logs.zip,l,%i)) { echo -a $ord(%i) item: | + | //var %i 1 | while ($zip(logs.zip,l,%i)) { echo -a $ord(%i) item: $v1 | inc %i } |
Note that the 1st item was the name of the folder, indicated by the trailing backslash | Note that the 1st item was the name of the folder, indicated by the trailing backslash | ||
</source> | </source> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Compatibility == | == Compatibility == | ||
− | + | 7.55 | |
− | |||
== See Also == | == See Also == | ||
{{collist | {{collist |