public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Merging and converting a Windows folder?
@ 2023-01-18 14:58 Robert Kingett
       [not found] ` <8da3b66e-f14a-49d3-9b65-826df906073an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Kingett @ 2023-01-18 14:58 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 713 bytes --]

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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8da3b66e-f14a-49d3-9b65-826df906073an%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1001 bytes --]

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

* Re: Merging and converting a Windows folder?
       [not found] ` <8da3b66e-f14a-49d3-9b65-826df906073an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-01-18 21:41   ` John O'Regan
  2023-01-19  9:28   ` BPJ
  1 sibling, 0 replies; 7+ messages in thread
From: John O'Regan @ 2023-01-18 21:41 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Hi Robert,

The following cmd command appends file2.md to the end of file1.md:

type file2.md >> file1.md

After the command is executed, file2.md is unchanged while file1.md
has been modified.

Is that what you want, or am I missing something?

Thanks!

John


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

* Re: Merging and converting a Windows folder?
       [not found] ` <8da3b66e-f14a-49d3-9b65-826df906073an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2023-01-18 21:41   ` John O'Regan
@ 2023-01-19  9:28   ` BPJ
       [not found]     ` <CADAJKhCQ0w7VXPPYBvE=0qJ7ip1TyMe3bWvJH3oGmF1b4tuBnA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: BPJ @ 2023-01-19  9:28 UTC (permalink / raw)
  To: pandoc-discuss

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

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 <kingettspeaks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/8da3b66e-f14a-49d3-9b65-826df906073an%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/8da3b66e-f14a-49d3-9b65-826df906073an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhCQ0w7VXPPYBvE%3D0qJ7ip1TyMe3bWvJH3oGmF1b4tuBnA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 3906 bytes --]

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

* Re: Merging and converting a Windows folder?
       [not found]     ` <CADAJKhCQ0w7VXPPYBvE=0qJ7ip1TyMe3bWvJH3oGmF1b4tuBnA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-01-19 12:15       ` kingettspeaks-Re5JQEeQqe8AvxtiuMwx3w
       [not found]         ` <477e4f86-2bf8-cffd-1512-05441b8fdb42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2023-01-19 20:44       ` Robert Kingett
  1 sibling, 1 reply; 7+ messages in thread
From: kingettspeaks-Re5JQEeQqe8AvxtiuMwx3w @ 2023-01-19 12:15 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw, BPJ

It does help! If I have multiple files in a folder the way you outlined, does the YAML have to be in all the chapters or can it just be in 001?


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

* Re: Merging and converting a Windows folder?
       [not found]         ` <477e4f86-2bf8-cffd-1512-05441b8fdb42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2023-01-19 18:18           ` BPJ
       [not found]             ` <CADAJKhBcuFVLOSJHbb-9gYW1RqrdiLOrqCHb8aBPZETqeBtV2Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: BPJ @ 2023-01-19 18:18 UTC (permalink / raw)
  To: kingettspeaks-Re5JQEeQqe8AvxtiuMwx3w; +Cc: pandoc-discuss, BPJ

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

It can be in the first file but I would put it in its own metadata.yaml
file and include it with the --metadata-file=YAMLFILENAME option. That way
you can convert the files singleton if you wish.

Den tors 19 jan. 2023 13:16 <kingettspeaks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> It does help! If I have multiple files in a folder the way you outlined,
> does the YAML have to be in all the chapters or can it just be in 001?
>

-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhBcuFVLOSJHbb-9gYW1RqrdiLOrqCHb8aBPZETqeBtV2Q%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 1452 bytes --]

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

* Re: Merging and converting a Windows folder?
       [not found]     ` <CADAJKhCQ0w7VXPPYBvE=0qJ7ip1TyMe3bWvJH3oGmF1b4tuBnA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2023-01-19 12:15       ` kingettspeaks-Re5JQEeQqe8AvxtiuMwx3w
@ 2023-01-19 20:44       ` Robert Kingett
  1 sibling, 0 replies; 7+ messages in thread
From: Robert Kingett @ 2023-01-19 20:44 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 3155 bytes --]

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...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/pandoc-discuss/8da3b66e-f14a-49d3-9b65-826df906073an%40googlegroups.com 
>> <https://groups.google.com/d/msgid/pandoc-discuss/8da3b66e-f14a-49d3-9b65-826df906073an%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.

[-- Attachment #1.2: Type: text/html, Size: 5245 bytes --]

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

* Re: Merging and converting a Windows folder?
       [not found]             ` <CADAJKhBcuFVLOSJHbb-9gYW1RqrdiLOrqCHb8aBPZETqeBtV2Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-11-22 18:09               ` Robert Kingett
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Kingett @ 2023-11-22 18:09 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1501 bytes --]

Wanted to bring this up again, I found a really easy way to convert all 
files in a directory, while merging them as well. The below command should 
be used in powershell.

pandoc (get-item *.txt).FullName -o final.docx

If you wanted to convert a directory of Docx files and merge them all into 
one, use the below command. I kept the --wrap=none in there because your 
text will look ghastly otherwise, so it's best to have no wrapping at all 
when converting to an MD or TXT file.

pandoc (get-item *.docx).FullName --wrap=none -o final.md
On Thursday, January 19, 2023 at 12:18:23 PM UTC-6 BPJ wrote:

> It can be in the first file but I would put it in its own metadata.yaml 
> file and include it with the --metadata-file=YAMLFILENAME option. That way 
> you can convert the files singleton if you wish.
>
> Den tors 19 jan. 2023 13:16 <kinget...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>
>> It does help! If I have multiple files in a folder the way you outlined, 
>> does the YAML have to be in all the chapters or can it just be in 001?
>>
>

-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/9eba1a7f-1ea4-444d-96c6-8f835ade1915n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 2299 bytes --]

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

end of thread, other threads:[~2023-11-22 18:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-18 14:58 Merging and converting a Windows folder? Robert Kingett
     [not found] ` <8da3b66e-f14a-49d3-9b65-826df906073an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-01-18 21:41   ` John O'Regan
2023-01-19  9:28   ` BPJ
     [not found]     ` <CADAJKhCQ0w7VXPPYBvE=0qJ7ip1TyMe3bWvJH3oGmF1b4tuBnA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-01-19 12:15       ` kingettspeaks-Re5JQEeQqe8AvxtiuMwx3w
     [not found]         ` <477e4f86-2bf8-cffd-1512-05441b8fdb42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2023-01-19 18:18           ` BPJ
     [not found]             ` <CADAJKhBcuFVLOSJHbb-9gYW1RqrdiLOrqCHb8aBPZETqeBtV2Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-11-22 18:09               ` Robert Kingett
2023-01-19 20:44       ` Robert Kingett

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 NNTP newsgroup(s).