\fB-g\fR
do not show the file group IDs (one group for each content)
.TP
+\fB-p\fR
+show progress information in stderr
+.TP
\fB-r\fR
shows the real path of the files
.SH "EXAMPLES"
.nf
-.B finddup -c blah something
+.B finddup -cg blah something
.fi
List files found in
.B ./blah/
which have a matching file with exact same content in
.B ./something/
+without the group IDs
.P
.B finddup ./sources not:./backup
.B ./backup.sources
.P
-.B finddup -g ./tralala ./cuicui | sort -n
+.B finddup ./tralala ./cuicui | sort -n
.fi
List groups of files with same content which exist both in
int show_realpaths = 0; /* 1 means ignore files and directories
starting with a dot */
-int show_progress = 1; /* 1 means show a progress bar when we are in a
+int show_progress = 0; /* 1 means show a progress bar when we are in a
tty */
int show_hits = 1; /* 1 means to show the files from dir2
struct file_with_size *node1, *node2;
struct stat sb1, sb2;
int not_in, found, same_dir;
+ int k, p, pp, l1, n;
if(strncmp(dirname2, "not:", 4) == 0) {
not_in = 1;
same_dir = (sb1.st_ino == sb2.st_ino);
- fprintf(stderr, "Scanning %s ... ", dirname1);
+ if(show_progress) {
+ fprintf(stderr, "Scanning %s ... ", dirname1);
+ }
+
list1 = scan_directory(0, dirname1);
+
if(same_dir) {
list2 = list1;
} else {
- fprintf(stderr, "%s ... ", dirname2);
+ if(show_progress) {
+ fprintf(stderr, "%s ... ", dirname2);
+ }
list2 = scan_directory(0, dirname2);
}
- fprintf(stderr, "done.\n");
+
+ if(show_progress) {
+ fprintf(stderr, "done.\n");
+ }
+
+ k = 0;
+ pp = -1;
+ n = 0;
+ l1 = file_list_length(list1);
if(not_in) {
for(node1 = list1; node1; node1 = node1->next) {
+ if(show_progress) {
+ p = (100 * n)/l1;
+ if(p > pp) {
+ fprintf(stderr, "%d%%\n", p);
+ pp = p;
+ }
+ n++;
+ }
+
found = 0;
for(node2 = list2; !found && node2; node2 = node2->next) {
}
} else {
- int k = 0;
-
for(node1 = list1; node1; node1 = node1->next) {
+ if(show_progress) {
+ p = (100 * n)/l1;
+ if(p > pp) {
+ fprintf(stderr, "%d%%\n", p);
+ pp = p;
+ }
+ n++;
+ }
+
for(node2 = list2; node2; node2 = node2->next) {
if(node1->inode != node2->inode && same_files(node1, node2)) {
if(node1->id < 0) {
fprintf(out, " -d ignore dot files and directories\n");
fprintf(out, " -c do not show which files in DIR2 corresponds to those in DIR1\n");
fprintf(out, " -g do not show the file groups\n");
+ fprintf(out, " -p show progress\n");
fprintf(out, " -r show the real file paths\n");
fprintf(out, "\n");
fprintf(out, "Report bugs and comments to <francois@fleuret.org>\n");
setlocale (LC_ALL, "");
while (1) {
- c = getopt(argc, argv, "hrcgd");
+ c = getopt(argc, argv, "hrcgdp");
if (c == -1)
break;
show_groups = 0;
break;
+ case 'p':
+ show_progress = 1;
+ break;
+
case 'c':
show_hits = 0;
break;