emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dired-duplicates 62fc41cacd: Ignore subdirectories and


From: ELPA Syncer
Subject: [elpa] externals/dired-duplicates 62fc41cacd: Ignore subdirectories and files that can not be read
Date: Sat, 11 Nov 2023 12:57:43 -0500 (EST)

branch: externals/dired-duplicates
commit 62fc41cacd21b0338d556543aef278220a2d8c5f
Author: Harald Judt <h.judt@gmx.at>
Commit: Harald Judt <h.judt@gmx.at>

    Ignore subdirectories and files that can not be read
    
    Signed-off-by: Harald Judt <h.judt@gmx.at>
---
 README.org          |  2 ++
 dired-duplicates.el | 11 +++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index 8431514f42..86d59e82aa 100644
--- a/README.org
+++ b/README.org
@@ -17,6 +17,8 @@ By default, the results will be grouped visually by 
separating them using empty
 lines, but this grouping can also be deactivated by setting the custom variable
 =dired-duplicates-separate-result= to =nil=.
 
+dired-duplicates will silently ignore unreadable directories and files.
+
 * Requirements
 For performance reasons, a checksum program like =md5= or =sha256sum= will be
 used for generating checksums of file contents if available and executable on
diff --git a/dired-duplicates.el b/dired-duplicates.el
index ca30051673..3a690d542f 100644
--- a/dired-duplicates.el
+++ b/dired-duplicates.el
@@ -179,13 +179,16 @@ temporary buffer for the hash calculation."
 
 It is possible to provide one or more root DIRECTORIES.  Returns
 a hash-table with the checksums as keys and a list of size and
-duplicate files as values."
+duplicate files as values.  Subdirectories and files that cannot
+be read will be silently ignored."
   (cl-loop with files = (dired-duplicates--apply-file-filter-functions
                          (mapcan
                           (lambda (d)
-                            (if dired-duplicates-search-directories-recursively
-                                (directory-files-recursively d ".*")
-                              (cl-remove-if #'file-directory-p 
(directory-files d t nil t))))
+                            (seq-remove (lambda (f)
+                                          (not (file-readable-p f)))
+                                        (if 
dired-duplicates-search-directories-recursively
+                                            (directory-files-recursively d 
".*" nil t)
+                                          (seq-remove #'file-directory-p 
(directory-files d t nil t)))))
                           directories))
            and same-size-table = (make-hash-table)
            and checksum-table = (make-hash-table :test 'equal)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]