0

What do I do before I combine all separate files? Or do we have a program/software that combines files? I have a lot of text files but I want them all in one part/file. I want all separate files/text files in one file.

2
  • 3
    For which OS? Only plain text files? In which order?
    – unor
    Dec 6, 2016 at 17:07
  • 1
    I have Windows. In the files, I have text but it shows me that the type of files are File. Dec 6, 2016 at 19:48

3 Answers 3

2
type  *.txt > one_big_file.txt

works for me on Windows 7.

It will show the name of each file in the console, and I can't see how to supress it, but it answers your question - if you want the files included in alphabetical order.

(of course, this answer is better suited to a question on https://superuser.com/ than here ;-)

9
  • 1
    If you got the answer, please award it, to help others who search for this in future. No need to ask in SupersSer. This is the correct place to ask for an app - but my answer is not an app Dec 7, 2016 at 23:00
  • 1
    Mine isn't an app either. I touch the award button but it tells me to wait 14 hours before I award myself. Do you want me to show your answer? and What wouldn't you suppress? Dec 7, 2016 at 23:11
  • 1
    It's fine to wait - normally you have to wait 2 days to accept your own answer. The important hing is that any future searchers find what worked for you Dec 7, 2016 at 23:13
  • 1
    What wouldn't you suppress? I think both answers did what I wanted. So would you want me to award yours? Dec 7, 2016 at 23:20
  • 1
    If you think one is better, select that. If both work, select your won - I don't need the points ;-) But, you could upvote mine, to show that it helped, which might help future searchers Dec 7, 2016 at 23:22
1

I am assuming that you need to have some control over the order that the files are combined in so will not wish to use wildcards.

On Windows (Command Prompt):

type file1.txt > all_files.txt
type file2.txt >> all_files.txt
type file3.txt >> all_files.txt
type file4.txt >> all_files.txt
type file5.txt >> all_files.txt

The above outputs the contents of the files to the terminal but redirects that output to the new file, the first line uses > will overwrite that file and any remaining lines have to use >> which appends to the file.

or:

copy file1.txt+file2.txt+file3.txt+file4.txt+file5.txt all_files.txt

This combines the files in memory and copies that to the new name beware this can go wrong if the files are too large or if the command line gets too long there are limitations on both.

(this differs in that the first one will always start each file on a new line)

On OS-X & Linux (in a terminal session):

cat file1.txt file2.txt file3.txt file4.txt file5.txt > all_files.txt
7
  • 1
    I got 500 files and the type of files are file. Will that still do it? Dec 6, 2016 at 19:44
  • It will as long as the files are all plain text files, i.e. ASCII on windows I think it will even work with UTF-8 files on OS-X/Linux - it does not care what the file extensions are but will not work if the files are other formats such as MS Word, etc. Dec 7, 2016 at 6:15
  • You will also have problems with structured formats such as html, xml, source code, etc. Dec 7, 2016 at 6:21
  • Oh I see. I will see if it works and if it does what I want, I will mark this as the answer. Where would the merged file go? and Do I write all_files.txt or another name? Dec 7, 2016 at 7:25
  • Whatever name you like as long as it is not the same as that of the files that you are merging from. Dec 7, 2016 at 7:35
0

on computer hope, I saw that you will open command prompt in the file folder or the folder that has all your file and type dir because you might see all your files and when you see all your files, you will type copy *.txt newfile.txt and you will get all separate file parts in one part or file.

If you want, you will rename the file and if you don't see your file type or file extension before you combine it, you will put the file extension next to the name of the file when you are renaming it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.