
@echo off
chcp 65001>nul
cd /d "%~dp0"


set Src0=%~n1
If Not Exist "%Src0%" echo. &&echo  [ Src0:%Src0% ] Not Found. &&echo. &&pause &&goto End
If Not Exist "%Src0%\*.*" echo. &&echo  [ Src0:%Src0%\*.* ] Not Found. &&echo. &&pause &&goto End

set Src1=%~n1.dir
set Src2=%~n1.arc
If Not Exist "%Src1%" echo. &&echo  [ Src0:%Src1% ] Not Found. &&echo. &&pause &&goto End
If Not Exist "%Src2%" echo. &&echo  [ Src0:%Src2% ] Not Found. &&echo. &&pause &&goto End

set LIST=%~n1.dirLIST

set Dest0=.
REM  If Exist "%Dest0%" echo. &&echo  [ Dest0:%Dest0% ] Aleady Existed. &&echo. &&pause &&goto End


set exePATH=%~dp0_exe

set qbms_exe=%exePATH%\quickbms.exe
If Not Exist "%qbms_exe%" echo. &&echo  [ _exe\quickbms.exe ] Not Found. &&echo. &&pause &&goto End

set bms0=%exePATH%\Xanadu_Next-ARC-INSERT_LIST.bms
If Not Exist "%bms0%" echo. &&echo  [ %bms0% ] Not Found. &&echo. &&pause &&goto End

set bms1=%exePATH%\Xanadu_Next-ARC-INSERT_REPLACE.bms
If Not Exist "%bms1%" echo. &&echo  [ %bms1% ] Not Found. &&echo. &&pause &&goto End



REM  -------------------------------------------------

If Exist "%LIST%" del /q "%LIST%">nul

"%qbms_exe%" -Q -F "*.*" -a "%Src0%" -D -o -Y "%bms0%" "%Src0%"

REM  -------------------------------------------------

If Not Exist "_backup" mkdir "_backup">nul
If Not Exist "_backup\%Src1%" copy /y /b "%Src1%" "_backup\%Src1%">nul
If Not Exist "_backup\%Src2%" copy /y /b "%Src2%" "_backup\%Src2%">nul

REM  -------------------------------------------------

If Exist "%LIST%" "%qbms_exe%" -Q -D -o -Y "%bms1%" "%Src1%" "%Dest0%"

If Exist "%LIST%" del /q "%LIST%">nul

REM  -------------------------------------------------



:End
REM  
echo. &&pause
