daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. echo.>%temp%vdat
  2. for /f "delims=" %%v in ('dir d:videos /b /s /a-d 2^>nul') do (
  3.     for /f "tokens=2 delims=," %%i in ('ffprobe -v quiet -show_entries "format=duration" -of csv "%%v"') do echo %%i/%%v/%%~zv
  4. )>>%temp%vdat
  5.  
  6. :begin
  7. for /f "tokens=1,2,3* delims=/" %%i in ('sort "%temp%vdat"') do if exist "%%j" call :strict "%%j" "%%i" "%%k"
  8. for /f "tokens=1,2,3* delims=/" %%i in ('sort "%temp%vdat"') do if exist "%%j" call :loose "%%j" "%%i" "%%k"
  9. exit /b
  10.  
  11. :strict
  12. :: if same exact duration+size then remove. blind to filenames. which is nice.
  13. if "%~2" equ "%lastdura%" if "%~3" equ "%lastsize%" recycle -f "%lastfull%" && echo recycled identical duplicate "%lastfile%"
  14. set "lastfile=%%~nx1" & set "lastfull=%%~1" & set "lastdura=%%~2" & set "lastsize=%%~3"
  15. exit /b
  16.  
  17. :loose
  18. :: if same exact duration+size within the megabyte+same start of filename then remove.
  19. if "%~2" equ "%lastdura%" echo %~3 | findstr /b /c:"%lastsize:~,-6%" >nul && echo "%~nx1" | findstr /i /c:"%lastbite%" >nul && recycle -f "%lastfull%" >nul && echo recycled near-identical "%lastfile%"
  20. set "lastfile=%%~nx1" & set "lastfull=%%~1" & set "lastdura=%%~2" & set "lastsize=%%~3"
  21. set "lastbite=%lastfile:~0,21%"
  22. exit /b
RAW Paste Data
Top