Merge all txt file in seprate file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
DingDang
Posts: 26
Joined: 06 Jul 2012 11:04

Merge all txt file in seprate file

#1 Post by DingDang » 10 Jul 2012 11:06

Hi,

I have multiple txt files in folder, i just want to merge all txt files in seprate file in same folder.

pls guide.

Squashman
Expert
Posts: 4471
Joined: 23 Dec 2011 13:59

Re: Merge all txt file in seprate file

#2 Post by Squashman » 10 Jul 2012 11:21

copy /A *.txt Newfile.tmp

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Merge all txt file in seprate file

#3 Post by abc0502 » 10 Jul 2012 11:27

@echo off
cls
For /F %%a in ('dir /B /A:-D *.txt') do (
for /f "tokens=*" %%b in (%%a) do echo %%b >>Final-File.txt
)

This code i think foxidrive posted before , i'm not sure exactly, but tested and working

Note:
forgot to say put the batch in the same folder with the files

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: Merge all txt file in seprate file

#4 Post by !k » 10 Jul 2012 11:59

Code: Select all

type *.txt >> _all.tmp
move _all.tmp _all.txt

Post Reply