Project

General

Profile

$zip » History » Version 8

Per Amundsen, 12/14/2019 09:58 AM

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 4 Per Amundsen
name - Name of the zip/unzip operation. (can be a [[Scripting_Wildcards|wildcard]])
18 1 Per Amundsen
[N] - The Nth matches name.
19
20
*Properties*
21
22
.name - Returns the name of zip/unzip operation.
23
.src - Returns the source file or folder.
24
.dest - Returns the destination file or folder.
25
.ratio - Returns 0, 1 or 2 where 0 = no compression, 1 = fastest compression, 2 = optimal compression.
26
.unzip - Returns [[$true]] if this is a unzip operation, otherwise [[$false]].
27
28
*Example*
29
30
<pre>
31
; Zip the entire adiirc folder into 'adiirc.zip'
32
//zip name $qt($adiircdir) adiirc.zip
33
34
; Print the zip result when then zip operation is finished.
35 5 Per Amundsen
on *:ZIP:name:echo -ag zipped $zip($zip).src into $zip($zip).dest status: $iif($ziperr,fail,ok)
36 1 Per Amundsen
</pre>
37 6 Per Amundsen
38
-----------------------------
39
40 7 Per Amundsen
*$zip(file.zip,cetlpo,file|dir,password,N)*
41 6 Per Amundsen
42
Create or extract zip files.
43
44
Returns "1" if the operation was successful, otherwise "0".
45
46
*Parameters*
47
48
file.zip - The zip file to list/test/create or extract.
49
cetlpo:
50
c - Create a new zip file.
51
e - Extract a zip file.
52
t - Test a zip file.
53
l - List number of files in a zip file or the Nth file.
54 8 Per Amundsen
p - *TODO*
55 6 Per Amundsen
o - Overwrite existing zip file or extract folder.
56
file|dir - File or directory to zip or directory to extract to.
57 8 Per Amundsen
password - *TODO*
58 6 Per Amundsen
N - Used with the "l", if N = 0, number of zipped files in the zip file, otherwise the Nth zipped file.
59
60
*Example*
61
62
<pre>
63
; Creates a new zip file called 'file.zip' and adds the file 'file,txt'.
64
//echo -ag $zip(file.zip, c, file.txt)
65
66
; Creates a new zip file called 'file.zip' and adds the folder 'folder'.
67
//echo -ag $zip(file.zip, c, folder)
68
69
; Extracts the zip file 'file.zip' to the folder 'extracted'.
70
//echo -ag $zip(file.zip, e, extracted)
71
72
; Prints number of zipped files in the zip file 'file.zip'.
73
//echo -ag $zip(file.zip, l, 0)
74
75
; Prints the file name of the first zipped file in the zip file 'file.zip'.
76
//echo -ag $zip(file.zip, l, 1)
77
</pre>