Function: org-attach-unset-directory

org-attach-unset-directory is an interactive and byte-compiled function defined in org-attach.el.gz.

Signature

(org-attach-unset-directory)

Documentation

Remove DIR node property.

If attachment folder is changed due to removal of DIR-property ask to move attachments to new location and ask to delete old attachment-folder.

Change of attachment-folder due to unset might be if an ID property is set on the node, or if a separate inherited DIR-property exists (that is different from the unset one).

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-attach.el.gz
(defun org-attach-unset-directory ()
  "Remove DIR node property.
If attachment folder is changed due to removal of DIR-property
ask to move attachments to new location and ask to delete old
attachment-folder.

Change of attachment-folder due to unset might be if an ID
property is set on the node, or if a separate inherited
DIR-property exists (that is different from the unset one)."
  (interactive)
  (let ((old (org-attach-dir))
	(new
         (progn
	   (org-entry-delete nil "DIR")
	   ;; ATTACH-DIR is deprecated and removed from documentation,
	   ;; but still works. Remove code for it after major nr change.
	   (org-entry-delete nil "ATTACH_DIR")
	   (org-attach-dir))))
    (unless (or (string= old new)
                (not old))
      (when (and new (yes-or-no-p "Copy over attachments from old directory? "))
        (copy-directory old new t nil t))
      (when (yes-or-no-p (concat "Delete " old))
        (delete-directory old t)))))