On Oct 12, 9:17 am, Sam <samcan...
> I have this batch below that combines file with a header in each
> file. This combines the files and removes the header. What I need is
> to combine the files but take the header row from one of the files and
> put it in the file that has all the files combined.
> Thanks in advance for your help!!!!
> DEL FileList_Combined_ELI.csv
> DEL Combined_ELI.csv
> dir *.csv/b > filelist
> for %%a in (*.csv) do more +1 %%a > CombinedELI
> Rename "CombinedELI" "Combined_ELI.csv"
> Rename "filelist" "FileList_Combined_ELI.csv"
The microsoft.public.scripting.wsh group is not the right place for
this question. First, microsoft has 'adandoned' it and second, it is
intended for questions related to Windows Script Host (WSH). Batch is
not WSH. Therefore, I have redirected my response into
alt.msdos.batch.nt, which is a more appropriate place for this
However, to answer your question, maybe something like this will
DEL FileList_Combined_ELI.csv 2> nul
DEL Combined_ELI.csv 2> nul
dir *.csv/b > filelist
set /p First= < filelist
copy %First% CombinedELI > nul
for %%a in (*.csv) do if /i not %%a==%First% more +1 %%a >>
Rename "CombinedELI" "Combined_ELI.csv"
Rename "filelist" "FileList_Combined_ELI.csv"
It copies the first file in the list in total (including its header)
to the combined destination and then adds all the rest, minus their