Цитата Arsenik77:
но надо чтобы в корнях тоже оставались только исключения. »
|
Код:
![Выделить весь код](images/misc/selectcode.png)
@echo off
setlocal
set "exclude=.txt .jpg .mp3"
for /d %%i in ("generalfolder\*") do (
pushd "%%i"
for /f "tokens=*" %%j in ('dir /b /s /a-d') do call:move "%%j"
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%"