Page 1 of 1
Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 1:13 pm
by NevilsStation
Is there a simple program somewhere that will combine multiple .doc files in a folder into one, please?
I've tried
and
Code: Select all
find . -maxdepth 1 -type f -name "*.doc" -print0 | xargs -0 cat > bigfile.doc
but in both cases bigfile.com only displays one of the documents (even though the file that's created is the right size to host them all).
Thanks!
Re: Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 1:20 pm
by Jerry3904
Re: Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 1:53 pm
by Richard
Thanks.
Good to know.
Re: Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 2:31 pm
by NevilsStation
Jerry3904 wrote: Thu Oct 11, 2018 1:20 pm
I do it this way:
I will try that - I saw it but had ignored it in favor of using a wildcard.
I'm trying to avoid having to type in the names of every file ... sometimes there may be dozens of them.
Why doesn't a wildcard work, please?
Re: Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 2:54 pm
by NevilsStation
No joy.
bigfile is the correct size for the two named files I specified but only the content of one of the originals is displayed when it's opened.
This is very odd ...
Re: Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 3:26 pm
by old_guy
NevilsStation
That won't work. The unix/linux commands like cat work with plain text files .Your .doc files have many many format commands included that can't be handled. To see, try to open one of your .doc files in featherpad.
You will have to cut/paste the contents of each .doc file into one new .doc file.
Earl
Re: Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 3:48 pm
by fehlix
@NevilsStation,
you can concatenat text files (aka "ascii" text files),
but you can't concatenate word-doc files to create a valid doc file.
What I would do:
- convert the doc to LibreOffice odt-files as show in this example:
( needs unoconv to be installed )
Code: Select all
unoconv -f odt -o my_odt_dir *.doc
- convert the xml-based odt-files into one big odt-LO-file
using OOoPy from here:
https://sourceforge.net/projects/ooopy/
extract and install like this
and merge/concatenate odt-files like this:
Code: Select all
ooo_cat --output-file my_big.odt file1.odt file2.odt file3.odt
# or
ooo_cat --output-file my_big.odt *.odt
Sure some formating might be lost during convertion from doc to odt.
If you only interested int the "Text" without formatiing just convert doc to txt
Code: Select all
unoconv -f txt -o my_txt_dir *.doc
and use

Re: Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 4:34 pm
by clicktician
fehlix wrote: Thu Oct 11, 2018 3:48 pm
If you only interested int the "Text" without formating just convert doc to txt
Very useful. I wish we still had the "thank" button on posts.
Re: Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 4:44 pm
by Jerry3904
You can also open one in LibreOffice, and repeatedly click Insert > Text from File. Then save as a new document.
Obviously not useful when there are zillions...
Re: Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 5:41 pm
by NevilsStation
Lots to try a bit later ... when I've lost daylight.
Question: The purpose of this exercise is to create an epub and/or other ebook format.
Each file is a chapter in a book of seven chapters.
Is there a program I can just point at the folder & which will can handle that, or
do I in any case have to concatenate them into a single file - with formatting
intact?
Thanks!
Re: Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 5:45 pm
by Jerry3904
In LibreOffice Master Document is designed for working with books and chapters. That's what we use with the Users Manual.
There's lots of good help on the web, search "libreoffice master document"
Re: Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 6:42 pm
by Gordon Cooper
If you are aiming to produce E-books you should give some thought to the final format too. For example .EPUB, which is a fairly popular format uses archives of html files, not text or .doc.
The method suggested by Jerry, using Libre Office, also has the advantage of being able to Export in EPUB. What ever you decide to do, I would not recommend a simple
concatenation of files into one big one. Keeping the chapters separate in a master document is much easier to to work with than a massive single file.
Re: Combine Several .doc Files to One?
Posted: Thu Oct 11, 2018 8:48 pm
by NevilsStation
Gordon Cooper wrote: Thu Oct 11, 2018 6:42 pm
If you are aiming to produce E-books you should give some thought to the final format too. For example .EPUB, which is a fairly popular format uses archives of html files, not text or .doc.
The method suggested by Jerry, using Libre Office, also has the advantage of being able to Export in EPUB. What ever you decide to do, I would not recommend a simple
concatenation of files into one big one. Keeping the chapters separate in a master document is much easier to to work with than a massive single file.
Thanks!