Computing the size in bytes of all the files in a
directory can be achieved with the Unix tool called du. There are
two draw backs with that tool under MSYS/MinGW:
- It is part of MinGW and thus requires the MinGW library.
- It prints out the size and the name of the directory.
Therefore, I created this tool that computes the
size exactly as required by the wpkg control files. There are two advantages:
- It computes a more realistic size
for the control file.
- It is not encumbered by the two disadvantages that du currently
Notice that this functionality is also available in
wpkg in the form of a command:
Usage is very simple:
dirsize <path> ...
# Nearly equivalent to: du -ks <path> ...
You can also use the --help and --version options
that give you a help screen and the version of the dirsize tool.
Since version 0.5, this functionality was
incorporated with the
and thus it probably renders this tool much less useful.
The --build option will automatically generate the Installed-Size
field if you don't define it yourself. (You may still need to
define the size since what is compressed in the
file may only be the tip of the iceberg! Yes! Your
script may use the installed data files to generate other files and
make the installation grow much larger than what is compressed
(1) The size of each item is rounded up
to 4Kb. This is what most people use under NTFS now a days, thought more and
more, with drives of 250Gb and larger, it is becoming 16Kb. At a later time, we
may decide to add a command line option to define this size. The size used
by du is 512 bytes. Now, to get a more realistic usage size for the target
system we should keep the size of each file in bytes. But that could be really
be large and probably not help that much since we still would have no clue of
the size necessary to create the files in the first place (the space used in
the directory structures.)