CALL C:\LiveDigital\config.bat

SET inet=down
for /f "tokens=5,7" %%a in ('ping -n 1 %var_supernode%') do (
    if "x%%a"=="xReceived" if "x%%b"=="x1," SET inet=up
)

IF "%inet%"=="up" (
	RMDIR /S /Q "%var_ftpdir%\"
	RMDIR /S /Q "%var_livedir%\live\"

	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%"
	)
	IF %var_noscreens% GTR 4 (
		MKDIR "%var_ftpdir%\screen%var_screen4%"
	)
	IF %var_noscreens% GTR 5 (
		MKDIR "%var_ftpdir%\screen%var_screen5%"
	)
	MKDIR "%var_livedir%\live"
	MKDIR "%var_livedir%\live\screen%var_screen0%"
	
	IF %var_noscreens% GTR 1 (
		MKDIR "%var_livedir%\live\screen%var_screen1%"
	)
	IF %var_noscreens% GTR 2 (
		MKDIR "%var_livedir%\live\screen%var_screen2%"
	)
	IF %var_noscreens% GTR 3 (
		MKDIR "%var_livedir%\live\screen%var_screen3%"
	)
	IF %var_noscreens% GTR 4 (
		MKDIR "%var_livedir%\live\screen%var_screen4%"
	)
	IF %var_noscreens% GTR 5 (
		MKDIR "%var_livedir%\live\screen%var_screen5%"
	)
	START /B C:\LiveDigital\ftp.bat
)

EXIT