emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Importing all files into .org document source blocks
@ 2013-05-24 12:03 Rainer M. Krug
  2013-05-24 20:49 ` Myles English
  0 siblings, 1 reply; 2+ messages in thread
From: Rainer M. Krug @ 2013-05-24 12:03 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]

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

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Importing all files into .org document source blocks
  2013-05-24 12:03 Importing all files into .org document source blocks Rainer M. Krug
@ 2013-05-24 20:49 ` Myles English
  0 siblings, 0 replies; 2+ messages in thread
From: Myles English @ 2013-05-24 20:49 UTC (permalink / raw)
  To: Rainer M. Krug; +Cc: emacs-orgmode


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-24 20:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-24 12:03 Importing all files into .org document source blocks Rainer M. Krug
2013-05-24 20:49 ` Myles English

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).