Articles

batch file to join files into one file

May 23, 2009 at 17:54:10
Specs: Windows XP

Hello
I am trying to make a batch file which will
do the following:
Scan for instance the F: drive and all of it
subfolders and look for a file say app.bat
and merge the contents of every find into
a single text file for viewing.
It would be good if wild cards could also be
used for instance app*.bat.
thanks
I will keep trying to figure it out

See More: batch file to join files into one file

Report •


#1
May 24, 2009 at 09:29:04

@echo off>merge.txt

for /r /d %%a in (.) do copy/b merge.txt+"%%a\*.bat" merge.txt


Report •

#2
May 24, 2009 at 12:28:02

It works great.
But could you tell me how to show above each
item found the path where found and put a
separator between each find like below.
f:\appf.bat
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

Thanks for you help
I really appreceiate it very much.
I


Report •

#3
May 25, 2009 at 09:36:36

I came up with the batch file below with some help from someone else
and it does what I wanted it to do.
thanks

@echo off
if exist merge.txt del merge.txt
rem line below creates a file named merge.txt
echo. >merge.txt
for /r %%a in (app*.bat) do (
echo %%a >>merge.txt
echo $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >>merge.txt
copy/b merge.txt+"%%a" merge.txt
)


Report •

Related Solutions


Ask Question