1 DeflOpt 2.07 of 05-Sep-2007
\r
2 Copyright (C) 2003-2007 by Ben Jos Walbeehm
\r
5 Some additional information regarding DeflOpt. I chose to put this in a text
\r
6 file, because I did not want to make the built-in help multiple pages long.
\r
8 First of all, for those who wish to contact me through e-mail: I get well over
\r
9 100 spam e-mails every day and because of that my own SpamKill program uses
\r
10 VERY aggressive settings. To circumvent that, make sure to put "DeflOpt" in
\r
11 the subject line when sending me an e-mail. The address is:
\r
12 walbeehm AT walbeehm DOT com.
\r
15 (From the built-in help)
\r
17 *** DeflOpt V2.07 ***
\r
18 *** Built on Wed Sep 5 18:56:30 2007 ***
\r
19 *** Copyright (C) 2003-2007 by Ben Jos Walbeehm ***
\r
23 DeflOpt tries to reduce the size of GZIP (extensions .gz and .tgz), PNG, and
\r
24 ZIP files. Regardless of which programs/settings were used to create them,
\r
25 DeflOpt will usually be able to reduce these files by at least a few bytes.
\r
28 [options] <filespec> [<filespec> [<filespec> ...]]
\r
31 /a: Scans all files that match the specifications to determine whether they
\r
32 are in a supported format (GZIP, PNG, ZIP), regardless of extensions.
\r
33 /b: Replaces files also when no bytes, but more than zero bits were saved.
\r
34 /d: Preserves the date and time of files it rewrites.
\r
35 /c: Comments in GZIP and ZIP files are kept. By default, these are removed.
\r
36 /f: Forces every file to be rewritten, even when no bits/bytes were saved.
\r
37 /k: Keeps all chunks/structures within files, even the mostly useless ones.
\r
38 /r: Recursively go through all subdirectories.
\r
39 /s: Silent mode. Nothing is displayed except in case of errors.
\r
42 Notes (for more detailed information, see DeflOpt.txt):
\r
43 - Options may be specified using both slashes ("/") and dashes ("-").
\r
44 - Wildcards * and ? are allowed, including in directory names.
\r
45 - For directories, all GZIP, PNG, and ZIP files in those directories are
\r
47 - If <filespec> has no extension, .gz, .tgz, .png, and .zip are used, unless
\r
48 the /a option is specified -- in that case, DeflOpt will scan every file to
\r
49 determine the format and process every file accordingly.
\r
50 - DeflOpt will NOT process GZIP, PNG, and ZIP files WITHIN (G)ZIP files.
\r
51 - By default, DeflOpt rewrites a file only when it can reduce the number of
\r
52 bytes of that file. It is possible that DeflOpt makes the deflated data
\r
53 one or more bits shorter but that this does not make the size in bytes less.
\r
54 Use the /b option to have DeflOpt rewrite files also when it can only
\r
55 save one or more bits but no actual bytes.
\r
58 DeflOpt /r *.zip abc*.png
\r
59 DeflOpt -K "C:\Documents and Settings\Ben Jos\My Documents\My Pictures"
\r
60 DeflOpt ..\..\stuff -b/c/k /FrS
\r
61 DeflOpt /adr C:\Prog* /f
\r
63 (End of From the built-in help)
\r
66 As its name implies (DeflOpt -- Deflate Optimisation), DeflOpt will not try to
\r
67 optimise files that use a type of compression different from LZ77 ("Deflate").
\r
68 It will also not process files compressed with the "Deflate64" type. Unlike
\r
69 the 1.XX versions of DeflOpt, versions 2.XX and above will not exit with an
\r
70 error message, but simply copy the compressed data of the types it does not
\r
74 As the examples show, options are case-insensitive and do not have to be
\r
75 separated by spaces, nor does the slash ("/") or dash ("-") even have to be
\r
76 repeated. For instance: "/b /c /f", "/b/c/f", and "/bcf" all mean the same.
\r
79 Regarding /a: By default, DeflOpt will only process files that have one of
\r
80 the extensions .gz, .png, .tgz, and .zip, and will assume that those files
\r
81 are valid. So if a ZIP file has the extension .png, DeflOpt will most likely
\r
82 fail with an error message. However, if /a is specified, then DeflOpt will
\r
83 scan all files that match the specifications to see if they are in any of
\r
84 the supported formats (GZIP, PNG, ZIP). This of course makes DeflOpt slower,
\r
85 but also smarter. Since there are many other extensions that are really just
\r
86 GZIP, PNG, or ZIP files, using /a will process those files too. In addition,
\r
87 if a file has the wrong extension (for instance a ZIP file that has the
\r
88 extension .png), then DeflOpt will still treat it correctly.
\r
91 Regarding /b: Bit gain vs. byte gain: In a zip file, technically it is
\r
92 possible to gain one bit per file for 8 files and save a total of 8 BYTEs.
\r
93 At the same time, it is possible to save 7 bits per file for 8 files, but not
\r
97 Regarding /f: The resulting file will never be larger than the input file.
\r
98 However, the resulting file may be slightly different, because DeflOpt always
\r
99 does certain things to make sure that certain fields do not have invalid
\r
100 values (CRCs, for instance).
\r
103 Regarding /k: Several structures within files are optional. By default,
\r
104 DeflOpt does not keep structures that are optional or mostly useless.
\r
105 What is optional or mostly useless depends on the file type:
\r
106 - For GZIP files: By default, only the original filename (if any) is kept
\r
107 (yes, I know it is optional, but it is "important enough to be kept"). The
\r
108 extra-text, comment, and 16-bit-CRC fields are only kept if /k is specified.
\r
109 Note that the comment is also kept if /c is specified.
\r
110 - For PNG files: By default, only IDAT, IEND, IHDR, PLTE, and tRNS chunks are
\r
111 kept. Specify /k to keep all other chunk types as well. If /k is specified,
\r
112 then DeflOpt will try to improve deflated data in iCCP, iTXt, and zTXt
\r
113 chunks as well. Note that when a PNG file contains multiple IDAT chunks,
\r
114 these will always be combined into one because there is absolutely no need
\r
115 to divide the compressed data over multiple IDAT chunks.
\r
116 - For ZIP files: By default, no optional fields are kept, so unless /k is
\r
117 specified, the optional fields zip-comment, file-comment, digital-signature,
\r
118 central-extra-field, and local-extra-field are not kept. Note that both
\r
119 types of comment fields will still be kept if /c is specified. Note that
\r
120 stored directory names within ZIP files as well as "Data Descriptors" will
\r
121 ALWAYS be removed, REGARDLESS of whether /k is specified or not. Both are
\r
122 ALWAYS redundant: The first because those directory names are also part of
\r
123 the filenames and every unzip program these days will create the necessary
\r
124 directories. The second because DeflOpt will store the necessary information
\r
125 directly in the local and central directory entries inside the ZIP file.
\r
126 "Data Descriptors" are only useful when the actual uncompressed size,
\r
127 compressed size, and 32-bit CRC are not yet known while compressing data;
\r
128 in other words, while piping/streaming data.
\r
131 Regarding /s and /v: These two options are mutually exclusive. If both are
\r
132 specified, then the one specified last will count.
\r
135 Regarding wildcards:
\r
136 Wildcards * and ? are allowed in directory names as well. However, unless /r
\r
137 ("recursive") is specified, wildcards will not match subdirectories of the
\r
138 directory that has the wildcards. So the file C:\TEMP\EXAMPLE\test.zip will
\r
139 only be processed by "C:\TEM*\*.zip" in case /r is specified. If /r is not
\r
140 specified, then it will only look for anything matching *.zip in the C:\TEMP
\r
141 directory and (if any) other directories that have a name starting with
\r
142 "C:\TEM", but not subdirectories of those directories. Because of the very
\r
143 powerful wildcards, DeflOpt will ONLY look at files that have one of the
\r
144 extensions .gz, .png, .tgz, and .zip, UNLESS /a is specified. So if there is
\r
145 a file called "c:\temp.txt", running "DeflOpt c:\temp.txt" will NOT process
\r
146 that file. Note, however, that if there were a "c:\temp.txt" DIRECTORY, then
\r
147 DeflOpt would look at all .gz, .png, .tgz and .zip files in that directory.
\r
148 If all the .gz and .tgz files in the current directory should be processed,
\r
149 but not the .png and .zip files, then use something like "DeflOpt *.gz *.tgz".
\r
151 Since wildcards can be used for both directories and files, this means that
\r
152 the "*" in "DeflOpt C:\TEST\*" will match both files and directories. Some
\r
155 "DeflOpt C:\TEST\*"
\r
156 This will process all the files in the C:\TEST directory as well as all the
\r
157 files in any of its subdirectories (but not THEIR subdirectories unless /r
\r
158 is specified). So the file C:\TEST\EXAMPLE\test.zip would be processed.
\r
160 "DeflOpt C:\TEST" (or "DeflOpt C:\TEST\.")
\r
161 This will process only the files in the C:\TEST directory.
\r
163 "DeflOpt C:\TEST\*\"
\r
164 This will process only the files in any of the subdirectories of the C:\TEST
\r
165 directory (but not THEIR subdirectories unless /r is specified).
\r
168 This will process all the files in the current directory as well as all the
\r
169 files in any of its subdirectories (but not THEIR subdirectories unless /r
\r
172 "DeflOpt ." (or "DeflOpt .\")
\r
173 This will process only the files in the current directory.
\r
176 This will process only the files in any of the subdirectories of the current
\r
177 directory (but not THEIR subdirectories unless /r is specified).
\r
179 By default, DeflOpt will only look at the extension to decide what kind of file
\r
180 it is dealing with, so if, for example, a GZIP file has the extension .zip, then
\r
181 DeflOpt will mostly likely exit with an error message. However, in case /a is
\r
182 specified, then DeflOpt will scan every file matching the specifications to see
\r
183 if they are in a supported format and process the ones that are.
\r
188 The first version of DeflOpt (V1.00) dates back to 04-Apr-2003. In short
\r
189 succession, many more versions followed until V1.16, which was created on
\r
190 22-Apr-2003. V1.16 was the first public version, although it was not publicly
\r
191 released until 27-Jun-2003.
\r
193 After that, development slowed down: V1.17 was created on 07-Sep-2003, V1.18
\r
194 on 15-Dec-2003, and V1.19 on 23-Feb-2004. I stopped development on DeflOpt
\r
195 very soon after having created V1.19, and that was part of the reason that
\r
196 V1.19 was not actually released publicly until more than 2 years afterwards.
\r
198 V2.00 of 10-Jul-2006:
\r
199 - Added GZIP (.gz and .tgz) and PNG support, in addition to ZIP support.
\r
200 - Even better optimisation. V2.00 gets a few more extra bytes out of a
\r
201 deflated file than V1.19 did, both because of better optimisation and
\r
202 because of additional removals of optional/useless structures.
\r
203 - No more exiting with an error message on unsupported ZIP compression methods
\r
204 (like Implode, Shrink, Reduce, Deflate64, etc.). Unsupported methods are
\r
205 simply copied without any attempt at optimisation.
\r
206 - More flexible wildcard matching, allowing wildcards to not just be part of
\r
207 the actual filenames, but also of directory names.
\r
208 - More options/switches.
\r
209 - By default, all "optional" and "mostly useless" structures/chunks are thrown
\r
210 away now, but /k can be specified to keep everything.
\r
211 - Stored directory names within ZIP files as well as "Data Descriptors" are
\r
213 - The /n option ("do not actually write any files") is gone.
\r
215 V2.01 of 15-Jul-2006:
\r
216 - Fixed the occasional "Compressed size is larger than it was!?!?!?" error.
\r
217 - Fixed a problem with stored blocks.
\r
218 - Added the /s option ("silent mode").
\r
220 V2.02 of 17-Jul-2006:
\r
221 - Significantly faster (2-6 times or more, depending on the input).
\r
223 V2.03 of 16-Nov-2006:
\r
224 - Fixed a very rare Access Violation.
\r
225 - Fixed a problem with zip files containing data descriptors.
\r
227 V2.04 of 20-Nov-2006:
\r
228 - Safer handling of zip files containing data descriptors.
\r
229 - Fixed a problem with zero-length files that have a compression method
\r
230 differing from "stored".
\r
232 V2.05 of 10-Mar-2007:
\r
233 - Fixed a problem of temporary files not always being deleted.
\r
235 V2.06 of 28-Apr-2007:
\r
236 - In very rare cases, DeflOpt would stop parsing compressed data before
\r
237 encountering the "End Of Block" marker. Fixed.
\r
239 V2.07 of 05-Sep-2007:
\r
240 - Added the /a option ("scan all files").
\r
241 - Added the /d option ("preserve date and time").
\r