Lars Aurdal
Lars Aurdal

Reputation: 113

In Emacs dired, how do I select files based on names from a list?

I open a buffer in emacs dired and select some files. How would I go about selecting files with the same name in another buffer? Ex: I select files a.txt, k.txt and z.txt in folder A. I then open a folder B in dired...how could I mark the files with the same names in folder B?

Upvotes: 0

Views: 174

Answers (1)

choroba
choroba

Reputation: 241758

The following elisp code worked for me with buffers dired1 and dired2.

(progn
  (switch-to-buffer "dired1")
  (dlet ((files (mapcar (lambda (path) (car (last (split-string path "/"))))
                        (dired-get-marked-files))))
    (switch-to-buffer "dired2")
    (dired-mark-sexp '(member name files))))

Upvotes: 0

Related Questions