(defun prot/copy-file-to-destinations--directory-prompt ()
"Produce the directory/destinations prompt of `prot/copy-file-to-destinations'."
(let ((skip-initial t)
destinations)
(while (or skip-initial (y-or-n-p"Add more destinations? "))
(when skip-initial
(setq skip-initial nil))
(push (read-directory-name"Select destination directory: ") destinations))
destinations))
(defun prot/copy-file-to-destinations (file destinations)
"Copy FILE to DESTINATIONS.
FILE is a string pointing to a file system path. DESTINATIONS is a list
of strings representing directories.
‑
In interactive use, prompt for FILE and then for DESTINATIONS. For each
selected destination, produce a `y-or-n-p' prompt on whether to add
another destination or perform the operation with the selected ones."
(interactive
(list
(read-file-name"File to copy: ")
(prot/copy-file-to-destinations--directory-prompt)))
(dolist (destination destinations)
(copy-file file destination :overwrite-if-it-exists))
(message"Copied %s to %s" file (mapconcat #'identity destinations ", ")))