@echo off
:: Concatenates files from dir %1 specified with wildcard %2 and outputs result to %3

:: TODO Proper temp file instead of bin\list.txt
IF EXIST %3 DEL %3
SET _LISTFILE="bin\list.txt"
>%_LISTFILE% (FOR /R "%~1" %%F IN (%2) DO echo "%%F")
sort /O %_LISTFILE% %_LISTFILE%
(FOR /F "usebackq delims=" %%F IN (`type "%_LISTFILE%"`) DO (
	echo /* %%F */ >> %3
	copy /b %3+%%F %3 1>NUL
	)
)

DEL %_LISTFILE%

devTools/concatFiles.bat