@ECHO OFF
IF NOT EXIST ..\..\GameDataFolder (
    ECHO Cannot find GameDataFolder!
) ELSE (
    ECHO Deleting local GameDataFolder if any...
    IF EXIST ..\GameDataFolder RMDIR /S /Q ..\GameDataFolder
    ECHO Deleting temporary folders if any...
    IF EXIST ..\temp RMDIR /S /Q ..\temp
    ECHO Deleting backup folders if any...
    IF EXIST backup RMDIR /S /Q backup
    ECHO Splitting original level archives...
    FOR %%L IN (0 1 2 3 4 6 8 9 10 11 12 13 14 18 19) DO (
        FOR %%D IN (..\GameDataFolder\level%%L_Final) DO (
            IF EXIST ..\%%D.dat (
                OniSplit.exe -export %%D ..\%%D.dat
            )
        )
    )
)
