python emacs / yasnippet-0.6.1c / snippets / text-mode / emacs-lisp-mode / dired.process_marked

#name : process marked files in dired
#contributor : Xah Lee
# --
;; idiom for processing a list of files in dired's marked files
;; suppose myProcessFile is your function that takes a file path
;; and do some processing on the file

(defun dired-myProcessFile ()
  "apply myProcessFile function to marked files in dired."
  (require 'dired)
  (mapc 'myProcessFile (dired-get-marked-files))

;; to use it, type M-x dired-myProcessFile