@echo off

setlocal
rem ***************************************************************************
rem * Use this cmd file to copy the built WAN Links project from the bin dir  *
rem * to a release directory.                                                 *
rem *                                                                         *
rem * Parameters:                                                             *
rem *                                                                         *
rem *    %1  <bin dir>     // bin directory to copy from                      *
rem *                                                                         *
rem *    %2  <rel dir>     // release directory to copy to                    *
rem *                                                                         *
rem *    %3  <file list>   // list of files to copy                           *
rem *                                                                         *
rem * Example:  CopyRelease bin\i386\Free \\comp\rel\40001640-A Houston.lst   *
rem *                                                                         *
rem ***************************************************************************

if "%1"=="" goto Usage
if NOT exist %1 goto Usage
if NOT exist %3 goto Usage
if "%2"=="" goto Usage
if NOT exist %2 md %2 & if ERRORLEVEL 1 goto ErrorMkDir

for /F %%i in (%3) do copy /v %1\%%i %2
if ERRORLEVEL 1 goto ErrorCopy

goto Exit

:Usage
echo Copies set of files needed for distributable releases.
echo.
echo %0 bin_dir rel_dir file_list
echo.
echo   bin_dir    Directory of binaries to copy (source)
echo   rel_dir    Directory of release binaries (destination)
echo              Note, if this directory doesn't exist, it will be
echo              created.
echo   file_list  File containing list of files to copy (e.g. all.lst)
echo.
:ExitUsage
goto Exit

:ErrorMkDir
echo.
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo.
echo ERROR: Mkdir failed!
echo.
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo.
goto Exit

:ErrorCopy
echo.
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo.
echo ERROR: Copy file failed!
echo.
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo.
goto Exit

:Exit
endlocal

xcopy %1\symbols %2\symbols\ /s /q
