Arsenik77,
Т.е. те, что исключение перемещать в корень, а остальные удалять?
Код:
@echo off
setlocal
set "exclude=.txt .jpg .mp3"
for /d %%i in ("generalfolder\*") do (
pushd "%%i"
for /d %%j in (*) do (
for /f "tokens=*" %%k in (' "2>nul dir /b /s /a-d "%%j"" ') do call:move "%%k"
)
popd
)
goto:eof
:move
for %%i in (cnt file check) do set "%%i="
for %%i in (%exclude%) do if /i "%%i"=="%~x1" set check=1
if not defined check del /a /q /f %1 && goto:eof
set "file=%~nx1"
:check
set /a cnt+=1
if exist "%file%" set "file=%~n1(%cnt%)%~x1" && goto:check
move %1 "%file%"