Need help to purse multiple file by dos batch script

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
dosnovis
Posts: 3
Joined: 06 Nov 2009 15:22

Need help to purse multiple file by dos batch script

#1 Post by dosnovis » 06 Nov 2009 15:32

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

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

#2 Post by avery_larry » 07 Nov 2009 21:06

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
)
)

dosnovis
Posts: 3
Joined: 06 Nov 2009 15:22

#3 Post by dosnovis » 10 Nov 2009 14:28

Thanks avery_larry for your help.

--AM

Post Reply