Batch File for grouping files - TechRepublic
General discussion
February 12, 2010 at 04:38 AM
barberd99

Batch File for grouping files

by barberd99 . Updated 16 years, 3 months ago

Hi all, I need a batch file to take the text from seveal test*txt (* being a variable number)files and group it in one file result.text, but also add part of the file name (the variable number)to each line!
i.e. file 1 text354.txt and contains ROW,partno1,1,01/03/2010
file 2 text654.txt and contains ROW,partno2,7,01/03/2010
ROW,partno3,5,01/03/2010

-so far I have got this
-@echo off>Group Files
-D:
-cd\
-cd test\files
-for /r /d %%a in (.) do copy/b
test.txt+”test*.txt” test.txt
-exit

this copies across the lines but replicates them! what am i doing wrong and how do I get the file name variable into the result file on each line
i.e. result.txt
ROW,partno1,1,01/03/2010,354
ROW,partno2,7,01/03/2010,654
ROW,partno3,5,01/03/2010,654
I would appreciate any help you can give on this please

This discussion is locked

All Comments