56723b3
.TH "hardlink" "1"
56723b3
.SH "NAME"
56723b3
hardlink \- Consolidate duplicate files via hardlinks
56723b3
.SH "SYNOPSIS"
56723b3
.PP
Todd Lewis cc12cc7
\fBhardlink\fP [\fB-c\fP] [\fB-n\fP] [\fB-v\fP] [\fB-vv\fP] [\fB-x pattern\fP] [\fB-h\fP] directory1 [ directory2 ... ]
56723b3
.SH "DESCRIPTION"
56723b3
.PP
4495481
This manual page documents \fBhardlink\fP, a
56723b3
program which consolidates duplicate files in one or more directories
56723b3
using hardlinks.
56723b3
.PP
4495481
\fBhardlink\fP traverses one
56723b3
or more directories searching for duplicate files.  When it finds duplicate
56723b3
files, it uses one of them as the master.  It then removes all other
56723b3
duplicates and places a hardlink for each one pointing to the master file.
56723b3
This allows for conservation of disk space where multiple directories
56723b3
on a single filesystem contain many duplicate files.
56723b3
.PP
56723b3
Since hard links can only span a single filesystem, \fBhardlink\fP
56723b3
is only useful when all directories specified are on the same filesystem.
56723b3
.SH "OPTIONS"
56723b3
.PP
56723b3
.IP "\fB-c\fP" 10
56723b3
Compare only the contents of the files being considered for consolidation.
56723b3
Disregards permission, ownership and other differences.
213f844
.IP "\fB-f\fP" 10
213f844
Force hardlinking across file systems.
56723b3
.IP "\fB-n\fP" 10
56723b3
Do not perform the consolidation; only print what would be changed.
56723b3
.IP "\fB-v\fP" 10
3f7d2b4
Print summary after hardlinking.
3f7d2b4
.IP "\fB-vv\fP" 10
3f7d2b4
Print every hardlinked file and bytes saved. Also print summary after hardlinking.
Todd Lewis cc12cc7
.IP "\fB-x pattern\fP" 10
Todd Lewis cc12cc7
Exclude files and directories matching pattern from hardlinking.
56723b3
.IP "\fB-h\fP" 10
56723b3
Show help.
Todd Lewis cc12cc7
.PP
Todd Lewis cc12cc7
The optional pattern for excluding files and directories must be a PCRE2
Todd Lewis cc12cc7
compatible regular expression. Only the basename of the file or directory
Todd Lewis cc12cc7
is checked, not its path. Excluded directories' contents will not be examined.
56723b3
.SH "AUTHOR"
56723b3
.PP
4495481
\fBhardlink\fP was written by Jakub Jelinek <jakub@redhat.com>.
56723b3
.PP
56723b3
Man page written by Brian Long.
56723b3
.PP
56723b3
Man page updated by Jindrich Novy <jnovy@redhat.com>
4495481
.SH "BUGS"
4495481
.PP
4495481
\fBhardlink\fP assumes that its target directory trees do not change from under
4495481
it.  If a directory tree does change, this may result in \fBhardlink\fP
4495481
accessing files and/or directories outside of the intended directory tree.
4495481
Thus, you must avoid running \fBhardlink\fP on potentially changing directory
4495481
trees, and especially on directory trees under control of another user.
Todd Lewis cc12cc7
.PP
Todd Lewis cc12cc7
Historically \fBhardlink\fP silently excluded any names beginning with
Todd Lewis cc12cc7
".in.", as well as any names beginning with "." followed by exactly 6
Todd Lewis cc12cc7
other characters. That prior behavior can be achieved by specifying
Todd Lewis cc12cc7
.br
aa6325a
-x '^(\\.in\\.|\\.[^.]{6}$)'