This has been very helpful so far! I get an error when I try and run one of your commands, though. I am trying the numbered files method, with all chapters in a folder, numbered like so.

0010-intro.md

0020-part1.md

0030-part2.md.

With all the files in the directory, I run the following command.

pandoc -s -o merged.odt *.md

The error I get is,

pandoc: *.md: withBinaryFile: invalid argument (Invalid argument)

Any ideas on what could be the problem with the above? All of your other suggestions have worked so far!
On Thursday, January 19, 2023 at 3:28:54 AM UTC-6 BPJ wrote:
You can just list the files on the command line as multiple inputs and pandoc will merge them automatically:

pandoc -o merged.ext chap-1.md chap-2.md chap-3.md

(where .ext is .html, .pdf or whatever.)

Tip: if the files have different names you can give them leading zero-padded (all with the same number of digits) at the start of the file names:

0010-foreword.md
0020-introduction.md
0030-problem.md
0040-this.md
...
0070-that.md
...
0100-conclusions.md

And then you should be able to just say

pandoc -o merged.ext *.md

and the files should be correctly ordered by the shell.

The point of "spacing out" the numbers as I did above is that if you add or rearrange a file you can just change its number to something intermediate instead of renumbering all the files; e.g. if you want to move the "that" chapter to before the "this" chapter you just rename it 0035-that.md. I realize that e.g. in a dissertation you are not as likely to rearrange chapters, but e.g. in documentation, where I work nowadays, it happens with some frequency.

I hope this is helpful.

/bpj

Den ons 18 jan. 2023 15:58Robert Kingett <kinget...@gmail.com> skrev:
I've tried to look online, for both a powershell command and a CMD command, possibly even a batch file, that would concatenate/merge multiple Markdown, .MD, files in a directory and then output it as one, merged, file, but nothing I've found works, so could someone point me in the right direction?

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8da3b66e-f14a-49d3-9b65-826df906073an%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/935e5a2c-a0cf-4afa-8303-e62db5af072cn%40googlegroups.com.