2

I am trying to copy a whole bunch different files' contents into one big file. Is there a way to do this without having to open up each individual file and copying and pasting the contents? Is there a quick way to just right click a file and copy the contents directly? Thanks in advance!

  • 1
    Are you talking about plain text files or some other format? – nohillside Mar 8 '15 at 20:16
  • Some are plain text, but just for completeness, I would like JUST the text, regardless of the format. So converting to plain text and then copying – TwoShorts Mar 8 '15 at 20:17
  • 1
    There is no generic way for non-plain text files, you need to be specific about the application/format (Word doc, Pages etc.) – nohillside Mar 8 '15 at 20:18
  • 1
    Ok. Then just plain text is ok. – TwoShorts Mar 8 '15 at 20:18
  • You should be able to print them to one PDF using 'lpr', this way its also possible to keep the images and layout/style as well. – CousinCocaine Mar 8 '15 at 21:23
7

You can run the shell command /usr/bin/textutil in the Terminal.app found in /Applications/Utilities/

textutils Can be used to convert the text from one format to another.

But it also can "Read the specified files, concatenate them, and write the result out as a single file in the indicated format."

/usr/bin/textutil file/s -cat convert to format -output file output path

It will concatenate differently formatted files.

The formats textutils can read and write to are

txt, html, rtf, rtfd, doc, docx, wordml, odt, or webarchive

Example

/usr/bin/textutil foo1.txt foo2.txt foo1.rtf foo.html -cat txt -output /file/path/foo.txt

  • Nice way to use to use textutil for doing this. – CousinCocaine Mar 8 '15 at 21:15
4

If you are talking about plain text files, you can accomplish this in Terminal by running

cat file1.txt file2.txt file3.txt > bigfile.txt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .