gzip-links - run gzip but deal with files which have multiple (hard) links
gzip-links [--allow-no-files] [--debug] [--help] [--no] [--stdin0] [--version] [-1] [-2] [-3] [-4] [-5] [-6] [-7] [-8] [-9] [-N] [--name] [-n] [--no-name] [-q] [--quiet] [-v] [--verbose] [--fast] [--best] [--rsyncable] [switch]... file...
gzip-links is like gzip but it allows you to compress multiply-linked files. It does this by removing all but one of the links, compressing the data under the remaining name, then linking to the removed names (plus .gz).
Don't complain if no files are given. This is particularly useful with --stdin0, such as when feeding in find output when you don't know if there will be any matches.
Turn debugging on. Use multiple times for more detail.
Show the usage message and die.
Go through the motions as possible, but don't change anything.
Read null-terminated file names (such as from
find -print0) from stdin and treat them like the files specified as arguments. This is
necessary because all of the names for a file have to be seen by the same gzip-links invocation, and with
xargs -0 this can't be guaranteed.
Show the version number and exit.
These switches are passed along to gzip.
--name doesn't make much sense in the multiply-linked case, since only 1 name (the first given on the command line) is saved.
--quiet affect gzip-links as well.
--verbose affect gzip-links as well.
$ ls -liG total 3 3499474 -rw-rw-r-- 2 roderick 623 Feb 17 14:48 mult.1 3499474 -rw-rw-r-- 2 roderick 623 Feb 17 14:48 mult.2 3499476 -rw-rw-r-- 1 roderick 316 Feb 17 14:49 single $ gzip-links -v * gzip-links: compressing mult.1 for mult.2 mult.1: 40.2% -- replaced with mult.1.gz single: 36.3% -- replaced with single.gz gzip-links: relinking mult.1.gz to mult.2.gz $ ls -liG total 2 3499477 -rw-rw-r-- 2 roderick 397 Feb 17 14:48 mult.1.gz 3499477 -rw-rw-r-- 2 roderick 397 Feb 17 14:48 mult.2.gz 3499474 -rw-rw-r-- 1 roderick 226 Feb 17 14:49 single.gz $ _
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ for updated versions.
Roderick Schertler <firstname.lastname@example.org>