concatenate multiple dat files in 1 txt file

March 13, 2011 at 23:43:15
Specs: Windows XP
concatenate the contents and file name of multiple dat files in 1 txt file

See More: concatenate multiple dat files in 1 txt file

Report •


#1
March 14, 2011 at 16:11:54
@echo off
type File1.dat > final.txt
type File2.dat >> final.txt
type File3.dat >> final.txt

Report •

#2
March 15, 2011 at 00:57:26
copy file1.dat+file2.dat+file3.dat file.dat

Report •

#3
March 15, 2011 at 07:27:39
Thank you very much

Report •

Related Solutions

#4
March 15, 2011 at 07:46:54
I tried, but It did not work. Igot this answer
DASAPS2806101.dat
The file cannot be copied onto itself.
0 file(s) copied.

Report •

#5
March 15, 2011 at 08:39:46
Sorry to boder you again. What I need is this:

I have several dat files, and need to concatenate the contents of each file and the file names (of dat files), in one txt file. If you can help me I would grately appreciate.

DASAPS2806101.dat
HD280610DAS4000107202030000101100
DT285449011004000107200000000001570DR00000000
DT306128011004000107200000000016800DR00000000
DT324911011004000107200000000005825DR00000000
DT348721011004000107200000004890897DR00000000
DT349157011004000107200000000007420DR00000000
DT355592011004000107200000000016940DR00000000
DT359630011004000107200000000007560DR00000000
DT359653011004000107200000000008316DR00000000
DT363074011004000107200000000005164DR00000000
DT364233011004000107200000000003962DR00000000
DT364564011004000107200000000180233DR00000000
DT365093011004000107200000000001980DR00000000
DV030000128061000005146667DR0012
TO 5146667DR0000000012
DASBNF2806102.dat
HD280610DAS4000107202030000101100
DT285774011004000107200000000001700DR00000000
DT285940011004000107200000000003400DR00000000
DT344661011004000107200000000025932DR00000000
DT348736011004000107200000000012800DR00000000
DT348811011004000107200000000003400DR00000000
DT348969011004000107200000000001380DR00000000
DT359844011004000107200000000002700DR00000000
DT361942011004000107200000000100275DR00000000
DT362390011004000107200000000003173DR00000000
DT364062011004000107200000000004571DR00000000
DT365585011004000107200000000064641DR00000000
DT365652011004000107200000000255532DR00000000
DV030000128061000000479504DR0012
TO 479504DR0000000012


Report •

#6
March 15, 2011 at 10:38:11
And the code I gave you did not work. It works for me.

Report •

#7
March 15, 2011 at 11:09:49
I modified your code
@echo off
type *.dat > new.txt
Result
DASAPS2806101.dat
The file cannot be copied onto itself.
0 file(s) copied.
Then I removed the > and all the text in all dat files were concatenated in the txt file, but the dat file names were not included. I want that the file name is included in the txt file. For example 1.dat , 2.dat, 3.dat
The result should be
1.dat
the contents of 1.dat
2.dat
the contents of 2.dat
3.dat
the contents of 3.dat

Thank you for your support


Report •

#8
March 16, 2011 at 15:05:31
try this..
==============================
@echo off >newfile.txt
for /f %%a in ('dir /b *.dat') do (
echo %%a >>newfile.txt
type %%a >>newfile.txt
)

===============================

Subhash Chandra.


Report •

#9
March 17, 2011 at 00:01:47
It worked!!!!!! Than you very much.

Report •


Ask Question