Page 1 of 1

Need help to purse multiple file by dos batch script

Posted: 06 Nov 2009 15:32
by dosnovis
Hi there,
I am trying to purse several files into one file which will do the following-
All the files are at a location say C:\ftproot\Test
The file names are like CBC_HW_001.csv, ABC_HW_001.csv, GBG_HW_001.csv etc. I want to purse them all like *HW_001.csv in one file where the first line from each file would be excluded and the rest would be pursed as it is.

I tried the following script to test but it is not working-
@echo off

for /f "skip=1 tokens=1,2* delims=, " %%a in (C:\ftproot\Test\*MSG_STAT-_001.csv) do (@echo %%a %%b %%c)
pause
EXIT /b

Can anybody help me?

thanks,
AM

Posted: 07 Nov 2009 21:06
by avery_larry
Special characters in the file could cause some issues, but essentially:

for %%a in (c:\ftproot\test\*msg_stat-_001.csv) do (
for /f "usebackq skip=1 tokens=1,2* delims=, " %%b in ("%%~a") do (
@echo %%b %%c %%d
)
)

Posted: 10 Nov 2009 14:28
by dosnovis
Thanks avery_larry for your help.

--AM