С сохранением структуры папок
Код:
@Echo Off
Set "BoxIn=Z:\Box_In"
Set "File1=* +.txt"
Set "File2=* + +.txt"
Set "File3=* + + +.txt"
Set "BoxOut1=Z:\Box_Out\+"
Set "BoxOut2=Z:\Box_Out\+ +"
Set "BoxOut3=Z:\Box_Out\+ + +"
FOR /F "usebackq delims=" %%f IN (`Dir "%BoxIn%\%File3%" /B /A-D /S 2^>nul`) DO Call :PlusMove "%%f" "%BoxOut3%"
FOR /F "usebackq delims=" %%f IN (`Dir "%BoxIn%\%File2%" /B /A-D /S 2^>nul`) DO Call :PlusMove "%%f" "%BoxOut2%"
FOR /F "usebackq delims=" %%f IN (`Dir "%BoxIn%\%File1%" /B /A-D /S 2^>nul`) DO Call :PlusMove "%%f" "%BoxOut1%"
GoTo :Eof
:PlusMove
Set "In=%~dp1"
Set "Out=%~2"
Call Set "Out=%%In:%BoxIn%=%Out%%%
If Not Exist "%Out%" Md "%Out%"
Move %1 "%Out%" >nul
GoTo :Eof
Без сохранения структуры папок (внимание! при совпадении имён в разных папках останется один файл с этим именем)
Код:
@Echo Off
Set "BoxIn=Z:\Box_In"
Set "File1=* +.txt"
Set "File2=* + +.txt"
Set "File3=* + + +.txt"
Set "BoxOut1=Z:\Box_Out\+"
Set "BoxOut2=Z:\Box_Out\+ +"
Set "BoxOut3=Z:\Box_Out\+ + +"
FOR /F "usebackq delims=" %%f IN (`Dir "%BoxIn%\%File3%" /B /A-D /S 2^>nul`) DO Call :PlusMove "%%f" "%BoxOut3%"
FOR /F "usebackq delims=" %%f IN (`Dir "%BoxIn%\%File2%" /B /A-D /S 2^>nul`) DO Call :PlusMove "%%f" "%BoxOut2%"
FOR /F "usebackq delims=" %%f IN (`Dir "%BoxIn%\%File1%" /B /A-D /S 2^>nul`) DO Call :PlusMove "%%f" "%BoxOut1%"
GoTo :Eof
:PlusMove
If Not Exist %2 Md %2
Move /Y %1 "%~2\" >nul
GoTo :Eof