Emacs Lisp: renumber-files, rename bunch of file names in Dired by date and number

Emacs Lisp: renumber-files, rename bunch of file names in Dired by date and number

This function works within Dired or Directory Editor in GNU Emacs. It will rename bunch of files and renumber them automatically by date and number of the file. It is useful when you are renaming less important images or bunch of files with irrelevant file names.

(defun renumber-files ()
  "This function works within Dired or Directory Editor in GNU
  Emacs. It will rename bunch of files and renumber them
  automatically by date and number of the file. It is useful when
  you are renaming less important images or bunch of files with
  irrelevant file names."
  (interactive)
  (let* ((files (dired-get-marked-files))
     (count 1))
    (dolist (file files)
      (let* ((extension (file-name-extension file))
         (filename (format "%s-%06.f.%s" (format-time-string "%F") count extension)))
    (rename-file file filename)
    (setq count (+ count 1))))))

Leave Your Comment or Contact GNU.Support

Contact GNU.Support now. There is a simple rule at GNU.Support: if we can help you, we do, whenever and wherever necessary, and it's the way we've been doing business since 2002, and the only way we know


Full name:


E-mail:


Message: