18 |
18 |
19 ==long-description |
19 ==long-description |
20 |
20 |
21 Generates compressed archives of files or extracts files from a compressed archive. Both 'zip' and 'gzip' file formats are support ('zip' is used by default). |
21 Generates compressed archives of files or extracts files from a compressed archive. Both 'zip' and 'gzip' file formats are support ('zip' is used by default). |
22 |
22 |
23 ==argument filename archive optional |
23 ==argument filename zipfile optional |
24 |
24 |
25 The zip archive to create or extract. |
25 The zip archive to create or extract. If the zipfile argument is not specified when creating a zip, the first C<file> argument's name is used with a .zip or .gz extension appended. |
26 |
26 |
27 ==option bool v verbose |
27 ==option bool v verbose |
28 |
28 |
29 Enables additional reporting of information regarding the zip/unzip process. |
29 Enables additional reporting of information regarding the zip/unzip process. |
30 |
30 |
31 ==option bool u unzip |
31 ==option bool u unzip |
32 |
32 |
33 Extract files from the specified archive. |
33 Extract files from the specified zipfile. |
34 |
34 |
35 ==option filename d directory |
35 ==option filename d directory |
36 |
36 |
37 The directory to extract files into. Must be used in conjunction with '--unzip'. |
37 The directory to extract files into. Must be used in conjunction with C<--unzip>. If not specified, the current working directory is used. |
38 |
38 |
39 ==option bool r recurse |
39 ==option bool r recurse |
40 |
40 |
41 Include sub-directories and any files contained therein when archiving. |
41 Include sub-directories and any files contained therein when archiving. |
42 |
42 |
43 ==option filename f file multiple |
43 ==option filename f file multiple |
44 |
44 |
45 A file or directory to archive. Only applicable when creating a new archive. If a directory is specified then it and any files contained immediately within that directory are archived. Use --recurse to archive all sub-directories and files within the directory. |
45 A file or directory to add to the zipfile. Only applicable when creating a new archive. If a directory is specified then it and any files contained immediately within that directory are archived. Use --recurse to archive all sub-directories and files within the directory. |
46 |
46 |
47 ==option enum t compression-type |
47 ==option enum t compression-type |
48 |
48 |
49 ==enum-value zip |
49 ==enum-value zip |
50 |
50 |
52 |
52 |
53 ==enum-value gzip |
53 ==enum-value gzip |
54 |
54 |
55 GNU Zip format. Note, this format can only handle a single file. |
55 GNU Zip format. Note, this format can only handle a single file. |
56 |
56 |
|
57 ==option bool o overwrite |
|
58 |
|
59 By default fzip will exit with an error if a file it is creating already exists on disk. Use this flag to silently overwrite instead. |
|
60 |
57 ==copyright |
61 ==copyright |
58 |
62 |
59 Copyright (c) 2008-2010 Accenture. All rights reserved. |
63 Copyright (c) 2008-2010 Accenture. All rights reserved. |
60 |
64 |
|
65 ==smoke-test |
|
66 |
|
67 export TESTDATA "This is some test data for fzip" |
|
68 echo -n "$TESTDATA" > test.txt |
|
69 rm test.txt.zip $Silent &| echo -n "" |
|
70 |
|
71 # Test zip |
|
72 fzip --file test.txt |
|
73 exists test.txt.zip || $Error |
|
74 rm test.txt |
|
75 |
|
76 # Test unzip |
|
77 fzip --unzip test.txt.zip |
|
78 exists test.txt || $Error |
|
79 cat -b test.txt | export -s RESULT |
|
80 var RESULT == "$TESTDATA" || $Error |
|
81 |
|
82 # Test that we don't overwrite files unless --overwrite is specified |
|
83 fzip --file test.txt $Silent &| var ? == "-11" || $Error |
|
84 fzip --file test.txt --overwrite |
|
85 |
|
86 fzip --unzip test.txt.zip $Silent &| var ? == "-11" || $Error |
|
87 fzip --unzip test.txt.zip --overwrite |
|
88 |
|
89 rm test.txt |
|
90 rm test.txt.zip |