Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I have grown tired of using evernote with wine or with any of the linux clients. I decided to change to Emacs and write all my notes in markdown so I can easily publish them in HTML and sync them with Dropbox. For organizing my notes I thought of putting them in separate folders and having a script make a .org file with a list of all my .md files. The structure I imagined was something like this:

* ~/Dropbox/Notebook1/

** [[~/Dropbox/Notebook1/][notefile1]]
** [[~/Dropbox/Notebook1/][notefile2]]

* ~/Dropbox/Notebook2/

** [[~/Dropbox/Notebook2/][notefile3]]
** [[~/Dropbox/Notebook2/][notefile4]]

* ~/Dropbox/Notebook3/

** ~/Dropbox/Notebook3.1/
*** [[~/Dropbox/Notebook3.1/][notefile5]]
*** [[~/Dropbox/Notebook3.1/][notefile6]]

** ~/Dropbox/Notebook3.2/
*** [[~/Dropbox/Notebook3.2/][notefile7]]

The problem is that my scripting/programming skills are somewhere between very basic to none. I figured that I should begin with something like "find ~/Dropbox/ -name '*md' > list", but then I got lost. How can I take the output and manipulate it into the structure above?

share|improve this question

1 Answer 1

You'd want to loop over the results like this:

for file in `find ~/Dropbox -name '*.md'`; do; echo "[[$file]]"; done

But, I think a solution that will help you out in the long run, would be to use the built-in indexing features of Emacs Org Mode. You can specify your sources files in your .emacs file.

share|improve this answer
I think that solves my problem! Thanks =D – Guilherme Kenzo Santos Apr 13 '13 at 12:26
You could also use shopt -s globstar and then: for file in ~/Dropbox/**/*.md; do ... -- this will probably be marginally faster than the find version (since it's not calling an extra external command, although this won't be noticeable in your case), and will be more protected against funny filenames. – evilsoup Jul 6 '13 at 13:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.