@echo off

cd /d "%~dp0"

set input=%~nx1

:loop

If Exist "%input%" "_exe\PyLibs\python.exe" "_exe\Decompiler\ScenarioScript.py" --cp=ms932 "%~dp0%input%"

for %%f IN ("%~dp0%input%\*.py") DO (
If Not Exist "%~dp0%input%-py" mkdir "%~dp0%input%-py"
If Not Exist "%~dp0%input%-bin" mkdir "%~dp0%input%-bin"
move /y "%%f" "%~dp0%input%-py\.">nul
move /y "%~dp0%input%\%%~nf.bin" "%~dp0%input%-bin\.">nul
)

for %%f IN ("%~dp0%input%\*.bin") DO (
If Not Exist "%~dp0%input%_error" mkdir "%~dp0%input%_error">nul
move "%%f" "%~dp0%input%_error\."
goto loop
)

pause
