Re: [O] Importing all files into .org document source blocks

2013-05-24 Thread Myles English

Hi Rainer,

Rainer M. Krug writes:
> Is there a way of importing all files in a directory
> (/etc/apt/sources/list.d/) into an org document, with each being in a
> separate code block?

Maybe this?:

for i in `find . -maxdepth 1 -type f`; do
 echo "#+BEGIN_SRC :tangle /this/dir/${i}" >> afile.org
 cat "${i}" >> afile.org
 echo "#+END_SRC\n" >> afile.org
done

(this kind of reply is becoming a theme of mine)

Myles




[O] Importing all files into .org document source blocks

2013-05-24 Thread Rainer M. Krug
Hi

I would like to import all files in a directory into an org document,
and each file should be in one source block, so that tangling the
document, will result in all files created.

My reasoning: I am using org-mode to keep track of installations on my
machine (apt-get as well as other installs) to make it easier to
re-install a new version of the Linux when necessary.

Now apart from the installation commands, I also have to keep track of
the installation sources. I was thinking of having them in the document,
where each source (i.e. each file in /etc/apt/sources.list.d/.) has it's
own source block, so that I can easily change the Ubuntu version and
tangle the document to obtain the new sources. 

Now I am lazy, and adding each file manually is prone to errors
(i.e. forgetting one). Therefore my question:

Is there a way of importing all files in a directory
(/etc/apt/sources/list.d/) into an org document, with each being in a
separate code block?

Thanks,

Rainer

-- 
Rainer M. Krug


pgpMRzmiCTRVr.pgp
Description: PGP signature