Function: nnmairix-rename-files-consecutively

nnmairix-rename-files-consecutively is a byte-compiled function defined in nnmairix.el.gz.

Signature

(nnmairix-rename-files-consecutively PATH)

Documentation

Rename all nnml mail files in PATH so that they have consecutive numbers.

This should correct problems of wrong article counts when using nnmairix with nnml backends.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnmairix.el.gz
(defun nnmairix-rename-files-consecutively (path)
  "Rename all nnml mail files in PATH so that they have consecutive numbers.
This should correct problems of wrong article counts when using
nnmairix with nnml backends."
  (let* ((files
	 (sort
	  (mapcar #'string-to-number
		  (directory-files path nil "[0-9]+" t))
	  #'<))
	 (lastplusone (car files))
	 (path (file-name-as-directory path)))
    (dolist (cur files)
      (when (not (= cur lastplusone))
	(rename-file (concat path
			     (number-to-string cur))
		     (concat path
			     (number-to-string lastplusone)))
	(setq cur lastplusone))
      (setq lastplusone (1+ cur)))))