Function: mail-source-delete-old-incoming
mail-source-delete-old-incoming is an interactive and byte-compiled
function defined in mail-source.el.gz.
Signature
(mail-source-delete-old-incoming &optional AGE CONFIRM)
Documentation
Remove incoming files older than AGE days.
If CONFIRM is non-nil, ask for confirmation before removing a file.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/mail-source.el.gz
(defun mail-source-delete-old-incoming (&optional age confirm)
"Remove incoming files older than AGE days.
If CONFIRM is non-nil, ask for confirmation before removing a file."
(interactive "P")
(require 'gnus-util)
(let* ((now (current-time))
(diff (if (natnump age) age 30));; fallback, if no valid AGE given
files)
(setq files (directory-files
mail-source-directory t
(concat "\\`"
(regexp-quote mail-source-incoming-file-prefix))))
(while files
(let* ((ffile (car files))
(bfile (replace-regexp-in-string "\\`.*/\\([^/]+\\)\\'" "\\1"
ffile))
(filetime (file-attribute-modification-time
(file-attributes ffile))))
(setq files (cdr files))
(when (and (> (time-to-number-of-days (time-subtract now filetime))
diff)
(if confirm
(y-or-n-p
(format-message "\
Delete old (> %s day(s)) incoming mail file `%s'? " diff bfile))
(gnus-message 8 "\
Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile)
t))
(delete-file ffile))))))