join/append txt file from c:\mydir\

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
sal21
Posts: 22
Joined: 12 Jul 2016 12:58
Location: Italy

join/append txt file from c:\mydir\

#1 Post by sal21 » 25 Aug 2017 06:51

in c:\mydir\ have 87 .txt files.

i need via batch code, to append all lines from each .txt files in one big .txt file...
How to?

pieh-ejdsch
Posts: 246
Joined: 04 Mar 2014 11:14
Location: germany

Re: join/append txt file from c:\mydir\

#2 Post by pieh-ejdsch » 25 Aug 2017 08:22

Hello,

did you mean so? at command promt:

Code: Select all

@(for /f "delims=" %i in ('dir /b C:\mydir\*.txt') do @for /f usebackQdelims^=^ tokens^=*^eol^= %j in ("%i") do @ <nul set /p "=%j") >C:\mydir\oneBig.txt.log

Phil

miskox
Posts: 649
Joined: 28 Jun 2010 03:46

Re: join/append txt file from c:\mydir\

#3 Post by miskox » 25 Aug 2017 09:29

sal21 wrote:in c:\mydir\ have 87 .txt files.

i need via batch code, to append all lines from each .txt files in one big .txt file...
How to?


If they are in the correct order you can use this:

Code: Select all

copy *.txt new_file.txt


(this new_file.txt will have an EOF character at the end of file)

or

Code: Select all

copy /b *.txt a.a new_file.txt


(this new_file.txt will not have an EOF character at the end of file)

Hope this helps.

Saso

Post Reply