Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- chcp 65001 >nul
- echo Temp folder prepare...
- set "folder_temp=_Temp"
- if exist "%folder_temp%" rd /s /q "%folder_temp%"
- md "%folder_temp%"
- for /D %%a in ("????-??") do (
- xcopy "./%%a\" "./%folder_temp%/%%a\" >nul
- )
- cd "%folder_temp%"
- :: основа
- echo Sorting...
- set "folder_sort=Countries"
- for /f "usebackq delims=" %%c in ("../%~n0.txt") do (
- if not exist "%folder_sort%/%%~c\" md "%folder_sort%/%%~c"
- for /F "delims=" %%A in ('dir "*%%~c.*" /a:-d /b /s 2^>nul') do (
- set ym=%%~dpA
- call set ym=%%ym:~-8,7%%
- call move /y "%%A" "%folder_sort%/%%~c/%%ym%% %%~nxA" >nul
- )
- dir /a /b /s "%folder_sort%/%%~c\" | findstr .>nul || rd "%folder_sort%/%%~c"
- )
- echo Sorting remaining files...
- set "folder_other=%folder_sort%/_Other"
- if not exist "%folder_other%\" md "%folder_other%"
- for /D %%a in ("????-??") do (
- cd "%%a"
- for /R %%B in (*) do (
- move /y "%%B" "../%folder_other%/%%a %%~nxB" >nul
- )
- cd..
- )
- dir /a /b /s "%folder_other%\" | findstr .>nul || rd "%folder_other%"
- echo Moving sorted folder...
- robocopy "%folder_sort%" "../%folder_sort%" /e /move >nul
- cd..
- rd /s /q "%folder_temp%"
- echo Done!
- timeout 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement