rem CMDOW @ /HID

CALL C:\LiveDigital\config.bat

MKDIR "%var_ftpdir%"
MKDIR "%var_ftpdir%\screen%var_screen0%"
IF %var_noscreens% GTR 1 (
	MKDIR "%var_ftpdir%\screen%var_screen1%"
)

IF %var_noscreens% GTR 2 (
	MKDIR "%var_ftpdir%\screen%var_screen2%"
)

IF %var_noscreens% GTR 3 (
	MKDIR "%var_ftpdir%\screen%var_screen3%"
)

DEL "%var_livedir%\copy.log"
DEL "%var_livedir%\copy-temp.log"

DEL %var_livedir%\ftplog-screen%var_screen0%.txt
DEL %var_livedir%\ftplog-screen%var_screen0%-parsed.txt

DEL %var_livedir%\ftp\data\screen%var_screen0%\publish.bat

IF %var_noscreens% GTR 1 (
	DEL %var_livedir%\ftplog-screen%var_screen1%.txt
	DEL %var_livedir%\ftplog-screen%var_screen1%-parsed.txt
	
	DEL %var_livedir%\ftp\data\screen%var_screen1%\publish.bat
)

IF %var_noscreens% GTR 2 (
	DEL %var_livedir%\ftplog-screen%var_screen2%.txt
	DEL %var_livedir%\ftplog-screen%var_screen2%-parsed.txt
	
	DEL %var_livedir%\ftp\data\screen%var_screen2%\publish.bat
)

IF %var_noscreens% GTR 3 (
	DEL %var_livedir%\ftplog-screen%var_screen3%.txt
	DEL %var_livedir%\ftplog-screen%var_screen3%-parsed.txt
	
	DEL %var_livedir%\ftp\data\screen%var_screen3%\publish.bat
)

CD %var_livedir%

"C:\Program Files\7-Zip\7z.exe" x D:\compile-%var_screen0%.dat -aoa -o"%var_ftpdir%"

XCOPY "%var_ftpdir%\screen%var_screen0%" "%var_livedir%\live" /E /C /I /R /Y /D>copy_%var_screen0%.log

RMDIR "%var_ftpdir%screen\%var_screen0%"
DEL "%var_livedir%\copy_%var_screen0%.log"

IF %var_noscreens% GTR 1 (
	"C:\Program Files\7-Zip\7z.exe" x D:\compile-%var_screen1%.dat -aoa -o"%var_ftpdir%"

	XCOPY "%var_ftpdir%\screen%var_screen1%" "%var_livedir%\live" /E /C /I /R /Y /D>copy_%var_screen1%.log
	RMDIR "%var_ftpdir%screen\%var_screen1%"
	DEL "%var_livedir%\copy_%var_screen1%.log"	
)

IF %var_noscreens% GTR 2 (
	"C:\Program Files\7-Zip\7z.exe" x D:\compile-%var_screen1%.dat -aoa -o"%var_ftpdir%"

	XCOPY "%var_ftpdir%\screen%var_screen2%" "%var_livedir%\live" /E /C /I /R /Y /D>copy_%var_screen2%.log
	RMDIR "%var_ftpdir%screen\%var_screen2%"
	DEL "%var_livedir%\copy_%var_screen2%.log"
)

IF %var_noscreens% GTR 3 (
	"C:\Program Files\7-Zip\7z.exe" x D:\compile-%var_screen3%.dat -aoa -o"%var_ftpdir%"

	XCOPY "%var_ftpdir%\screen%var_screen3%" "%var_livedir%\live" /E /C /I /R /Y /D>copy_%var_screen3%.log
	RMDIR "%var_ftpdir%screen\%var_screen3%"
	DEL "%var_livedir%\copy_%var_screen3%.log"
)

startplayer.bat
EXIT