dired-map-over-marks

dired-map-over-marks is a Lisp macro in `dired.el'.

(dired-map-over-marks BODY ARG &optional SHOW-PROGRESS DISTINGUISH-ONE-MARKED)

Eval BODY with point on each marked line. Return a list of BODY's results.
If no marked file could be found, execute BODY on the current
line. ARG, if non-nil, specifies the files to use instead of the
marked files.

If ARG is an integer, use the next ARG (or previous -ARG, if
ARG<0) files. In that case, point is dragged along. This is so
that commands on the next ARG (instead of the marked) files can
be chained easily.
For any other non-nil value of ARG, use the current file.

If optional third arg SHOW-PROGRESS evaluates to non-nil,
redisplay the dired buffer after each file is processed.

No guarantee is made about the position on the marked line.
BODY must ensure this itself if it depends on this.

Search starts at the beginning of the buffer, thus the car of the
list corresponds to the line nearest to the buffer's bottom.
This is also true for (positive and negative) integer values of
ARG.

BODY should not be too long as it is expanded four times.

If DISTINGUISH-ONE-MARKED is non-nil, then if we find just one
marked file, return (t FILENAME) instead of (FILENAME).