Join txt files w/ there filenames as headers

April 18, 2011 at 14:04:03
Specs: Windows XP
I'm looking to make a VB script, that will take all the txt file i have in one folder and merge them in to one file, but the trick is to keep the file name as a header before the text of the file. Say I have the following files:

---- file1.txt ----
aaa
bbb
ccc
-------------------

---- file2.txt ----
ccc
ddd
eee
-------------------

Then the resulting file should look like:

---- result.txt ---
file1.txt

aaa
bbb
ccc

file2.txt
ccc
ddd
eee

-------------------

How can I code this with VB?


See More: Join txt files w/ there filenames as headers

Report •

#1
April 22, 2011 at 04:15:33
I'd do a VBScript, but in this case, batch is easier:
type *.txt > result.txt 2>&1

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question