Function: trashed-read-files

trashed-read-files is a natively compiled function defined in trashed.el.

Signature

(trashed-read-files)

Documentation

Read trash information from trash files and info directories.

The information is stored in tabulated-list-entries, where ID is trash file name in files directory, and DESC is a vector of file type(-/D), size, deletion date and original filename.

Source Code

;; Defined in /nix/store/7ppdacjhnynz276lxxnfw8sdz6r2k6h2-emacs-packages-deps/share/emacs/site-lisp/elpa/trashed-20230811.157/trashed.el
(defun trashed-read-files ()
  "Read trash information from trash files and info directories.
The information is stored in `tabulated-list-entries', where ID is trash file
name in files directory, and DESC is a vector of file type(-/D), size,
deletion date and original filename."
  ;; Initialization
  (setq trashed-trash-can-size 0)
  (trashed-update-col-width 1 nil)
  (trashed-update-col-width 2 nil)
  (trashed-update-col-width 3 nil)
  ;; Read files
  (let (files)
    (if (eq system-type 'windows-nt)
        ;; Read trash cans in all drives
        (let ((drive-letter ?a))
          (while (<= drive-letter ?z)
            (aset trashed-trash-dir 0 drive-letter)
            (setq files
                  (append files
                          (or (ignore-errors (directory-files-and-attributes
                                              trashed-trash-dir t nil t))
                              ;; Retry it w/o sid
                              (let ((trashed-trash-dir (file-name-directory
                                                        trashed-trash-dir)))
                                (ignore-errors (directory-files-and-attributes
                                                trashed-trash-dir t nil t)))))
                  drive-letter (1+ drive-letter))))
      (setq files (ignore-errors (directory-files-and-attributes
                                  trashed-files-dir nil nil t))))
    (setq tabulated-list-entries
          (cl-loop for (file . attrs) in files
                   for entry = (trashed-file-info file attrs)
                   when entry collect entry))))