Combining multiple txt files (or any file)

DataMine
by DataMine · 2 posts
8 years ago in Batch
Posted 8 years ago · Author
This dos command will allow you to merge all txt files contained in a folder into one txt file.

I used this command when I needed to combine 43 txt files containing retired IMVU names into a single txt file so it could be posted here: viewtopic.php?t=1073.


Instructions:
1) Copy the following command:
Code
copy /v *.txt "filename.txt"


2) Paste it into notepad or your text editor of choice.

3) Replace "filename.txt" with whatever you want the final file to be name. Remember to keep the quotation marks. You can specify just a name if you want it to be saved in the same folder as the other files or you can specify a directory like this: "C:\User\User\Desktop\filename.txt"

4) Save the file as "merge files.bat". You can name it whatever you want but make sure you save it as a bat file.

5) Place the bat file you just created in the same folder as all of the txt files you want to merge and then double click it to run it.

What this will do is takes all of the txt files found in whatever folder you run this script in and merges them into a single file with the new file name. The /v switch verifies that new files are written correctly.



This can be used with other file types as well and you could even select a only a couple files instead of every file in the folder. If you want to know how to do that, simply modify the code like this:

Code
copy /v [file]+[file]+[file] [new file]


Example:
Code
copy /v 1.txt+2.txt+3.txt "new.txt"

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT