@echo off
setlocal enabledelayedexpansion
for /f %%i in ('dir /b /a-d ^| findstr "...._....~...."') do (
set "str=%%i"
for /f %%a in ('dir /b /ad ^| findstr "^.._!str:~0,4!#.exe$"') do (
set "folder=%%a"
)
if exist "!folder!\" (
move "%%i" "!folder!\"
)
)