Reputation: 75
I have to merge files in a folder to a single text file and I'm not sure how to do that
Upvotes: 1
Views: 1022
Reputation: 404
You can use simple redirection operator with command type
suppose your directory contains 3 files a.txt b.dat
and myfile
then just use type * >> outfile
this will copy contents of all the files to file named outfile
Upvotes: 0
Reputation: 836
Use FOR /F: http://ss64.com/nt/for_d.html
For example, to concatenate all the text files in the current directory and any subdirectories, you could do:
FOR /F "tokens=*" %G IN ('dir /b /s *.txt') DO TYPE %G >> out.txt
Upvotes: 3
Reputation: 160
copy /b *.txt newfile.txt
make sure all the text files are in the same folder along with the .bat
Upvotes: 2