Advertisement
Redee

Батник для торрента - Windows 10 Spotlight

Jun 21st, 2022
1,558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.21 KB | None | 0 0
  1. @echo off
  2. chcp 65001 >nul
  3.  
  4. echo Temp folder prepare...
  5. set "folder_temp=_Temp"
  6. if exist "%folder_temp%" rd /s /q "%folder_temp%"
  7. md "%folder_temp%"
  8.  
  9. for /D %%a in ("????-??") do (
  10.     xcopy "./%%a\" "./%folder_temp%/%%a\" >nul
  11. )
  12. cd "%folder_temp%"
  13.  
  14. :: основа
  15.  
  16. echo Sorting...
  17. set "folder_sort=Countries"
  18. for /f "usebackq delims=" %%c in ("../%~n0.txt") do (
  19.     if not exist "%folder_sort%/%%~c\" md "%folder_sort%/%%~c"
  20.    
  21.     for /F "delims=" %%A in ('dir "*%%~c.*" /a:-d /b /s 2^>nul') do (
  22.         set ym=%%~dpA
  23.         call set ym=%%ym:~-8,7%%
  24.         call move /y "%%A" "%folder_sort%/%%~c/%%ym%% %%~nxA" >nul
  25.     )
  26.     dir /a /b /s "%folder_sort%/%%~c\" | findstr .>nul || rd "%folder_sort%/%%~c"
  27. )
  28.  
  29. echo Sorting remaining files...
  30. set "folder_other=%folder_sort%/_Other"
  31. if not exist "%folder_other%\" md "%folder_other%"
  32. for /D %%a in ("????-??") do (
  33.     cd "%%a"
  34.     for /R %%B in (*) do (
  35.         move /y "%%B" "../%folder_other%/%%a %%~nxB" >nul
  36.     )
  37.     cd..
  38. )
  39. dir /a /b /s "%folder_other%\" | findstr .>nul || rd "%folder_other%"
  40.  
  41. echo Moving sorted folder...
  42. robocopy "%folder_sort%" "../%folder_sort%" /e /move >nul
  43.  
  44. cd..
  45. rd /s /q "%folder_temp%"
  46.  
  47. echo Done!
  48. timeout 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement