Minor typo.
[finddup.git] / finddup.1
1 .TH "FINDDUP" "1.2" "Apr 2011" "Francois Fleuret" "User Commands"
2
3 \" This man page was written by Francois Fleuret <francois@fleuret.org>
4 \" and is distributed under a Creative Commons Attribution-Share Alike
5 \" 3.0 License.
6
7 .SH "NAME"
8
9 finddup \- Find files common to two directories (or not)
10
11 .SH "SYNOPSIS"
12
13 \fBfinddup\fP [OPTION]... [DIR-OR-FILE1 [[and:|not:]DIR-OR-FILE2]]
14
15 .SH "DESCRIPTION"
16
17 With one directory as argument, \fBfinddup\fP prints the duplicated
18 files found in it. If no directory is provided, it uses the current
19 one as default.
20
21 With two directories, it prints either the files common to both DIR1
22 and DIR2 or, with the `not:' prefix, the ones present in DIR1 and not
23 in DIR2. The `and:' prefix is assumed by default and necessary only if
24 you have a directory name starting with `not:'. Files are handled like
25 directories containing a single file.
26
27 This command compares files by first comparing their sizes, hence goes
28 reasonably fast.
29
30 When looking for identical files, \fBfinddup\fP associates a group ID
31 to every content, and prints it along the file names. Use the \fB-g\fP
32 to switch it off.
33
34 Note that
35 .B finddup DIR
36 is virtually the same as
37 .B finddup -i DIR DIR
38
39 .SH "OPTIONS"
40 .TP
41 \fB-v\fR, \fB--version\fR
42 print the version number and exit
43 .TP
44 \fB-h\fR, \fB--help\fR
45 print the help and exit
46 .TP
47 \fB-d\fR, \fB--ignore-dots\fR
48 ignore files and directories starting with a dot
49 .TP
50 \fB-0\fR, \fB--ignore-empty\fR
51 ignore empty files
52 .TP
53 \fB-c\fR, \fB--hide-matchings\fR
54 do not show which files from DIR2 correspond to files from DIR1
55 (hence, show only the files from DIR1 which have an identical twin in
56 DIR2)
57 .TP
58 \fB-g\fR, \fB--no-group-ids\fR
59 do not show the file group IDs
60 .TP
61 \fB-t\fR, \fB--time-sort\fR
62 sort files in each group according to the modification times
63 .TP
64 \fB-q\fR, \fB--trim-first\fR
65 do not print the first file in each group
66 .TP
67 \fB-p\fR, \fB--show-progress\fR
68 show progress information in stderr
69 .TP
70 \fB-r\fR, \fB--real-paths\fR
71 show the real path of the files
72 .TP
73 \fB-i\fR, \fB--same-inodes-are-different\fR
74 files with same inode are considered as different
75 .TP
76 \fB-e \fI<command>\fR, \fB--exec \fI<command>\fR
77 execute the provided command for each group of identical files, with
78 their names as arguments
79 .TP
80 \fB-f \fI<string>\fR, \fB--result-prefix \fI<string>\fR
81 for each group of identical files, write one result file whose name is
82 the given prefix string followed by the group number, and containing
83 one file name per line
84
85 .SH "BUGS"
86
87 None known, probably many. Valgrind does not complain though.
88
89 Since files with same inodes are considered as different when looking
90 for duplicates in a single directory, there are weird behaviors -- not
91 bugs -- with hard links.
92
93 The current algorithm is dumb, as it does not use any hashing of the
94 file content.
95
96 Here are the things I tried, which did not help at all: (1) Computing
97 md5s on the whole files, which is not satisfactory because files are
98 often not read entirely, hence the md5s cannot be properly computed,
99 (2) computing XORs of the first 4, 16 and 256 bytes with rejection as
100 soon as one does not match, (3) reading files in parts of increasing
101 sizes so that rejection could be done with only a small fraction read
102 when possible, (4) using mmap instead of open/read.
103
104 .SH "WISH LIST"
105
106 The format of the output should definitely be improved. Not clear how.
107
108 There could be some fancy option to link two instances of the command
109 running on different machines to reduce network disk accesses. This
110 may not help much though.
111
112 .SH "EXAMPLES"
113
114 .B finddup -p0d blah
115
116 .fi
117 List duplicated files in directory ./blah/, show a progress bar,
118 ignore empty files, and ignore files and directories starting with a
119 dot.
120
121 .B finddup -qtg
122
123 .fi
124 List all files which are duplicated in the current directory, do not
125 show the oldest in each each group of identical ones, and do not show
126 group numbers. This is what you could use to list what files to
127 remove.
128
129 .P
130 .B finddup sources not:/mnt/backup
131
132 .fi
133 List all files found in \fB./sources/\fR which do not have
134 content-matching equivalent in \fB/mnt/backup/\fR.
135
136 .P
137 .B finddup -g tralala cuicui
138
139 .fi
140 List groups of files with same content which exist both in
141 \fB./tralala/\fR and \fB./cuicui/\fR. Do not show group IDs, instead
142 write empty lines between groups of files of same content.
143
144 .SH "AUTHOR"
145
146 Written by Francois Fleuret <francois@fleuret.org> and distributed
147 under the terms of the GNU General Public License version 3 as
148 published by the Free Software Foundation. This is free software: you
149 are free to change and redistribute it. There is NO WARRANTY, to the
150 extent permitted by law.