I have a directory ~/foo/ containing lots of .org files. These files are generated by a script and I want to export them to .txt files. I currently use orgmk (specifically org2txt) to do this. My script is

for file in ~/foo/*.org; do
    org2txt ${file}

The problem is that this is slow. The documentation for orgmk mentions something about orgmk scripts having the capability to export all org documents under a directory recursively but I can't seem to figure out the commands to do this. Does anyone know how to speed up my script?

  • I guess this is slow because emacs is started for each of the files to be exported. Perhaps there's a way in orgmk to start emacs one time and export all the files? Otherwise it shouldn't be too difficult to script that within emacs.
    – JeanPierre
    May 7 '16 at 11:30
  • @JeanPierre Figuring out how to get orgmk to start emacs one time and export all the files is exactly what I'd like to do! May 8 '16 at 22:18
  • Per this thread, it appears that what you are asking for is not supported with orgmk.
    – nispio
    May 10 '16 at 6:30
  • I agree, I reviewed the scripts and I noticed that the orgmk call a new emacs session each time, also it seems that it doesn't use the (with-temp-buffer) macros which would help to speed-up. Also it treats all txt files as org-files, that may be an issue for you too. A possible short term solution is to create a wrapper that will call orgmk for each file concurrently (orgmk f1 & orgmk f2& etc). Otherwise you could work with the implementer to enhance it but it requires quite a bit of effort
    – Joafigue
    May 12 '16 at 5:11

If anyone's interested, the following bash script speeds up the process a bit.


find $1 -type f -iname "*.org" -print0 | parallel -0 org2txt

Per @Joafigue's recommendation this script runs orgmk for each file concurrently. Consequently it requires GNU Parallel.

Effectively, the script searches for all org files in the given path and runs the command

$ parallel org2txt ::: first.org second.org third.org ...

Obviously this is rather hackish, but I'm now significantly less bothered.

I'd still love to see orgmk gain the capability to process many files at once!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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