mirror of https://github.com/djcb/mu.git
Create numbered backup of attached file when already exists #2090
This commit is contained in:
parent
d6658c49b8
commit
58cff913fe
|
@ -503,7 +503,19 @@ containing commas."
|
|||
dir (if arg (read-directory-name "Save to directory: ") mu4e-attachment-dir))
|
||||
(cl-loop for (f . h) in handles
|
||||
when (member f files)
|
||||
do (mm-save-part-to-file h (expand-file-name f dir))))
|
||||
do (mm-save-part-to-file
|
||||
h (let ((file (expand-file-name f dir)))
|
||||
(if (file-exists-p file)
|
||||
(let (newname
|
||||
(count 1))
|
||||
(while (progn
|
||||
(setq newname (concat (file-name-sans-extension file)
|
||||
(format "(%s)" count)
|
||||
(file-name-extension file t)))
|
||||
(file-exists-p newname))
|
||||
(cl-incf count))
|
||||
newname)
|
||||
file)))))
|
||||
(mu4e-message "No attached files found"))))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue