@echo off
rem --- '4_collect.cmd' v1.6 by KdL (2017.06.07)

if exist emsx_top.pld.1chipmsx goto collect
if exist emsx_top.pld.zemmixneo goto collect
if not exist emsx_top.pld goto err_msg

:collect
if exist old_fw rd /S /Q old_fw
if exist fw ren fw old_fw
if exist emsx_top.pld.1chipmsx md fw\1chipmsx
move /y emsx_top.pld.1chipmsx fw\1chipmsx
move /y recovery.pof.1chipmsx fw\1chipmsx
move /y emsx_top.fit.summary.1chipmsx fw\1chipmsx
ren fw\1chipmsx\emsx_top.pld.1chipmsx emsx_top.pld
ren fw\1chipmsx\recovery.pof.1chipmsx recovery.pof
ren fw\1chipmsx\emsx_top.fit.summary.1chipmsx fit_summary.log
if exist emsx_top.pld.zemmixneo md fw\zemmixneo
move /y emsx_top.pld.zemmixneo fw\zemmixneo
move /y recovery.pof.zemmixneo fw\zemmixneo
move /y emsx_top.fit.summary.zemmixneo fw\zemmixneo
ren fw\zemmixneo\emsx_top.pld.zemmixneo emsx_top.pld
ren fw\zemmixneo\recovery.pof.zemmixneo recovery.pof
ren fw\zemmixneo\emsx_top.fit.summary.zemmixneo fit_summary.log
if exist emsx_top.pld md fw
move /y emsx_top.pld fw
move /y recovery.pof fw
move /y emsx_top.fit.summary fw
ren fw\emsx_top.fit.summary fit_summary.log
goto quit

:err_msg
cls
color f0
echo File not found!

:timer
waitfor /T 1 pause 2>NUL

:quit
del *.sof
exit
