I a开发者_Python百科m trying to copy the contents of one document and append it to another document through command prompt. It works fine for simple .txt file through the command (copy fileA.txt + fileb.txt). But when I try to copy the contents of a MSWord file to another MSWord file, it does not happen. Though the target file size keeps increasing but without any content. When opened the doc file in notepad, it shows soe unreadable data keeps getting added. Please help.
(These are unix commands; if you're running on Windows, you can use the appropriate equivalent or Cygwin)
For text files: cat file1 >> file2
For binary files or special formats (i.e., word): - write a program to pull the text from one and insert it into the other, preserving formatting, etc.
or
strings file2 >> file3
strings file1 >> file3
file3 now has all the text.
You can't simply concatenate MS Word files. They are binary files and concatenation can be made only using MS Word or some APIs. Not from command line
精彩评论