Project

General

Profile

$zip » History » Version 11

Per Amundsen, 02/23/2023 07:58 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
*$zip(file.zip,cetlpo,file|dir,password,N)*
45
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
| file.zip | The zip file to list/test/create or extract. |
55 6 Per Amundsen
cetlpo:
56 11 Per Amundsen
| c | Create a new zip file. |
57
| e | Extract a zip file. |
58
| t | Test a zip file. |
59
| l | List number of files in a zip file or the Nth file. |
60
| p | *TODO* |
61
| o | Overwrite existing zip file or extract folder. |
62
| file<notextile>|</notextile>dir | File or directory to zip or directory to extract to. |
63
| password | *TODO* |
64
| N | Used with the "l", if N = 0, number of zipped files in the zip file, otherwise the Nth zipped file. |
65 9 Per Amundsen
66
*Properties*
67 10 Per Amundsen
68 11 Per Amundsen
table(ktable).
69
|*Property*|*Description*|
70
| .csize | Returns the compressed size of the file. *(AdiIRC Only)* |
71
| .size | Returns the size of the file. |
72
| .mtime | Returns the last modification time of the file. |
73 6 Per Amundsen
74
*Example*
75
76
<pre>
77
; Creates a new zip file called 'file.zip' and adds the file 'file,txt'.
78
//echo -ag $zip(file.zip, c, file.txt)
79
80
; Creates a new zip file called 'file.zip' and adds the folder 'folder'.
81
//echo -ag $zip(file.zip, c, folder)
82
83
; Extracts the zip file 'file.zip' to the folder 'extracted'.
84
//echo -ag $zip(file.zip, e, extracted)
85
86
; Prints number of zipped files in the zip file 'file.zip'.
87
//echo -ag $zip(file.zip, l, 0)
88
89 1 Per Amundsen
; Prints the file name of the first zipped file in the zip file 'file.zip'.
90
//echo -ag $zip(file.zip, l, 1)
91
</pre>