Package: fdupes
Version: 1.50-PR2-1
Severity: wishlist

Hi,

I find useful to report duplicate files to users, but I rather stay out of
.mozilla, .evolution, .Trash and so on. For thar reason I created a patch that 
adds a
-A (--nohidden) option that excludes hidden files.

Please consider adding the attached patch to support this functionality.

-- System Information:
Debian Release: 5.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/1 CPU core)
Locale: LANG=es_AR.UTF-8, LC_CTYPE=es_AR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages fdupes depends on:
ii  libc6                         2.7-18     GNU C Library: Shared libraries

fdupes recommends no packages.

fdupes suggests no packages.

-- debconf-show failed
#! /bin/sh /usr/share/dpatch/dpatch-run
## 21_nohidden_support.dpatch by  <[email protected]>
##
## DP: Adds --nohidden support

@DPATCH@
diff -urNad fdupes-1.50-PR2~/fdupes.c fdupes-1.50-PR2/fdupes.c
--- fdupes-1.50-PR2~/fdupes.c	2009-01-13 14:13:33.000000000 -0200
+++ fdupes-1.50-PR2/fdupes.c	2009-01-13 14:14:14.000000000 -0200
@@ -31,6 +31,7 @@
 #endif
 #include <string.h>
 #include <errno.h>
+#include <libgen.h>
 
 #ifndef EXTERNAL_MD5
 #include "md5/md5.h"
@@ -51,6 +52,7 @@
 #define F_RECURSEAFTER      0x0200
 #define F_NOPROMPT          0x0400
 #define F_SUMMARIZEMATCHES  0x0800
+#define F_EXCLUDEHIDDEN     0x1000
 
 char *program_name;
 
@@ -240,6 +242,7 @@
   struct stat linfo;
   static int progress = 0;
   static char indicator[] = "-\\|/";
+  char *fullname, *name;
 
   cd = opendir(dir);
 
@@ -285,6 +288,17 @@
 	strcat(newfile->d_name, "/");
       strcat(newfile->d_name, dirinfo->d_name);
       
+      if (ISFLAG(flags, F_EXCLUDEHIDDEN)) {
+	fullname = strdup(newfile->d_name);
+	name = basename(fullname);
+	if (name[0] == '.' && strcmp(name, ".") && strcmp(name, "..") ) {
+	  free(newfile->d_name);
+	  free(newfile);
+	  continue;
+	}
+	free(fullname);
+      }
+
       if (filesize(newfile->d_name) == 0 && ISFLAG(flags, F_EXCLUDEEMPTY)) {
 	free(newfile->d_name);
 	free(newfile);
@@ -945,6 +959,7 @@
   printf("                  \tdisk area they are treated as non-duplicates; this\n"); 
   printf("                  \toption will change this behavior\n");
   printf(" -n --noempty     \texclude zero-length files from consideration\n");
+  printf(" -A --nohidden    \texclude hidden files from consideration\n");
   printf(" -f --omitfirst   \tomit the first file in each set of matches\n");
   printf(" -1 --sameline    \tlist each set of matches on a single line\n");
   printf(" -S --size        \tshow size of duplicate files\n");
@@ -996,6 +1011,7 @@
     { "hardlinks", 0, 0, 'H' },
     { "relink", 0, 0, 'l' },
     { "noempty", 0, 0, 'n' },
+    { "nohidden", 0, 0, 'A' },
     { "delete", 0, 0, 'd' },
     { "version", 0, 0, 'v' },
     { "help", 0, 0, 'h' },
@@ -1013,7 +1029,7 @@
 
   oldargv = cloneargs(argc, argv);
 
-  while ((opt = GETOPT(argc, argv, "frRq1Ss::HlndvhNm"
+  while ((opt = GETOPT(argc, argv, "frRq1Ss::HlnAdvhNm"
 #ifndef OMIT_GETOPT_LONG
           , long_options, NULL
 #endif
@@ -1046,6 +1062,9 @@
     case 'n':
       SETFLAG(flags, F_EXCLUDEEMPTY);
       break;
+    case 'A':
+      SETFLAG(flags, F_EXCLUDEHIDDEN);
+      break;
     case 'd':
       SETFLAG(flags, F_DELETEFILES);
       break;

Reply via email to