Function: org-attach-set-directory
org-attach-set-directory is an interactive and byte-compiled function
defined in org-attach.el.gz.
Signature
(org-attach-set-directory)
Documentation
Set the DIR node property and ask to move files there.
The property defines the directory that is used for attachments
of the entry. Creates relative links if org-attach-dir-relative
is non-nil.
Return the directory.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-attach.el.gz
(defun org-attach-set-directory ()
"Set the DIR node property and ask to move files there.
The property defines the directory that is used for attachments
of the entry. Creates relative links if `org-attach-dir-relative'
is non-nil.
Return the directory."
(interactive)
(let ((old (org-attach-dir))
(new
(let* ((attach-dir (read-directory-name
"Attachment directory: "
(org-entry-get nil "DIR")))
(current-dir (file-name-directory (or default-directory
buffer-file-name)))
(attach-dir-relative (file-relative-name attach-dir current-dir)))
(org-entry-put nil "DIR" (if org-attach-dir-relative
attach-dir-relative
attach-dir))
attach-dir)))
(unless (or (string= old new)
(not old))
(when (yes-or-no-p "Copy over attachments from old directory? ")
(copy-directory old new t t t))
(when (yes-or-no-p (concat "Delete " old))
(delete-directory old t)))
new))