Project

General

Profile

$zip » History » Version 12

Per Amundsen, 02/23/2023 08:00 PM

1 1 Per Amundsen
_Added in 2.9_
2
3
*$zip*
4
5
Returns the name of the zip operation during a [[on ZIP]] or [[on UNZIP]] event.
6 3 Per Amundsen
7
----------------
8 1 Per Amundsen
9
*$zip(name, [N])*
10
11
Returns information about a zip/unzip item during a [[on ZIP]] or [[on UNZIP]] event.
12
13
_See also [[/zip]], [[$ziperr]], [[on ZIP]], [[on UNZIP]]._
14
15
*Parameters*
16
17 11 Per Amundsen
table(ktable).
18
|*Parameter*|*Description*|
19
| name | Name of the zip/unzip operation. (can be a [[Scripting_Wildcards<notextile>|</notextile>wildcard]]) |
20
| [N] | The Nth matches name. |
21 1 Per Amundsen
22
*Properties*
23
24 11 Per Amundsen
table(ktable).
25
|*Property*|*Description*|
26
| .name | Returns the name of zip/unzip operation. |
27
| .src | Returns the source file or folder. |
28
| .dest | Returns the destination file or folder. |
29
| .ratio | Returns 0, 1 or 2 where 0 = no compression, 1 = fastest compression, 2 = optimal compression. |
30
| .unzip | Returns [[$true]] if this is a unzip operation, otherwise [[$false]]. |
31 1 Per Amundsen
32
*Example*
33
34
<pre>
35
; Zip the entire adiirc folder into 'adiirc.zip'
36
//zip name $qt($adiircdir) adiirc.zip
37
38
; Print the zip result when then zip operation is finished.
39 5 Per Amundsen
on *:ZIP:name:echo -ag zipped $zip($zip).src into $zip($zip).dest status: $iif($ziperr,fail,ok)
40 1 Per Amundsen
</pre>
41 6 Per Amundsen
42 1 Per Amundsen
-----------------------------
43
44 12 Per Amundsen
*$zip(file.zip,options,file|dir,password,N)*
45 1 Per Amundsen
46
Create or extract zip files.
47
48
Returns "1" if the operation was successful, otherwise "0".
49
50
*Parameters*
51
52 11 Per Amundsen
table(ktable).
53
|*Parameter*|*Description*|
54 1 Per Amundsen
| file.zip | The zip file to list/test/create or extract. |
55 12 Per Amundsen
| options | The zip options. |
56
| file<notextile>|</notextile>dir | File or directory to zip or directory to extract to. |
57
| password | *TODO* |
58
| N | Used with the "l", if N = 0, number of zipped files in the zip file, otherwise the Nth zipped file. |
59
60
*Options*
61
62
table(ktable).
63
|*Option*|*Description*|
64 11 Per Amundsen
| c | Create a new zip file. |
65
| e | Extract a zip file. |
66
| t | Test a zip file. |
67
| l | List number of files in a zip file or the Nth file. |
68
| p | *TODO* |
69
| o | Overwrite existing zip file or extract folder. |
70 9 Per Amundsen
71
*Properties*
72 10 Per Amundsen
73 11 Per Amundsen
table(ktable).
74
|*Property*|*Description*|
75
| .csize | Returns the compressed size of the file. *(AdiIRC Only)* |
76
| .size | Returns the size of the file. |
77
| .mtime | Returns the last modification time of the file. |
78 6 Per Amundsen
79
*Example*
80
81
<pre>
82
; Creates a new zip file called 'file.zip' and adds the file 'file,txt'.
83
//echo -ag $zip(file.zip, c, file.txt)
84
85
; Creates a new zip file called 'file.zip' and adds the folder 'folder'.
86
//echo -ag $zip(file.zip, c, folder)
87
88
; Extracts the zip file 'file.zip' to the folder 'extracted'.
89
//echo -ag $zip(file.zip, e, extracted)
90
91
; Prints number of zipped files in the zip file 'file.zip'.
92
//echo -ag $zip(file.zip, l, 0)
93
94 1 Per Amundsen
; Prints the file name of the first zipped file in the zip file 'file.zip'.
95
//echo -ag $zip(file.zip, l, 1)
96
</pre>