1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
@echo off setlocal set folder=c:\sourcedir set mask=*.csv set output=output.csv for /f "tokens=*" %%G in ('dir "%folder%\%mask%" /a:-d /b') do ( for /f "tokens=*" %%H in ('type "%folder%\%%G"') do ( echo %%G,%%H >> "%output%" ) )