emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Create sub-directories and files from within org


From: John Kitchin
Subject: Re: [O] Create sub-directories and files from within org
Date: Mon, 21 Oct 2013 21:10:31 -0400

You can do something like this:

#+BEGIN_SRC emacs-lisp
(defun make-project-dir-from-heading ()
  (interactive)
  (save-restriction
    (org-narrow-to-subtree)
    (let ((heading-title (nth 4 (org-heading-components))))
      (make-directory heading-title t)
      (goto-char (point-max))
      (insert (format "[[file:%s]]" heading-title)))))
#+END_SRC

* test-dir

some stuff

[[file:test-dir]]
* next-project


John

-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Mon, Oct 21, 2013 at 1:39 PM, Skip Collins <address@hidden> wrote:
On Sun, Oct 20, 2013 at 12:58 PM, John Kitchin <address@hidden> wrote:
>
> I don't understand what you are trying to do here. you could write a lisp
> function that you run in the ** project name heading that creates a directory
> by that name. But what would the txt files in that directory be?

I requested something like this functionality some time ago but never
found an answer. I create new projects in projects.org, via capture or
direct editing. Each project is a top-level heading that may sometimes
contain sub-headings, todos, etc. Most often it remains a simple
top-level heading containing a drawer but no body or subheadings. It
takes one of the following states: PROJ, DONE, CANCELED, or DORMANT. I
have several agenda views that track active projects (i.e. not done,
not canceled, and not dormant), and other tag attributes (personal,
professional, ...). I use a set of optional tags to track where
project data is kept: :org:, :computer:, :email:, :file:, :binder:,
etc. Many projects have the :computer: tag and a corresponding folder
on my hard drive with various file types stored there including txt,
docx, org, pdf, jpeg, etc. I would very much like a way to quickly
create that folder with the unique project name that I assign in the
top-level heading. It would be super nice if this automagic folder
creation feature also creates a link to the folder inside my
projects.org file.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]