filenames-ffconcat.cmd 903 B

12345678910111213141516171819202122232425262728293031323334
  1. @echo off
  2. chcp 65001
  3. setlocal enableextensions enabledelayedexpansion
  4. set SRCPATH=%~1
  5. if not defined SRCPATH call :PRINT_USAGE
  6. set DESTPATH=%~2
  7. if not defined DESTPATH set DESTPATH=%cd%
  8. set PATTERN=%~3
  9. if not defined PATTERN set PATTERN="\b*"
  10. set PROCS="%~dp0procs.cmd"
  11. if not exist "%SRCPATH%" call %PROCS% DIR_ERROR
  12. if not exist "%DESTPATH%" ( md "%DESTPATH%" || exit /b )
  13. for %%I in ( "%SRCPATH%." ) do set "OUTFILENAME=%%~nxI.ffconcat"
  14. set "PREVFILENAME=."
  15. :: Main cycle
  16. @echo.ffconcat version 1.0>"%DESTPATH%\%OUTFILENAME%" &&^
  17. call %PROCS% PROCDIR "%SRCPATH%" "%PATTERN%" "call :FN_TO_FFCONCAT ^"%%%%~I^" ^"%%%%PREVFILENAME%%%%^" %DESTPATH%\%OUTFILENAME%"
  18. echo.Ready. File "%DESTPATH%\%OUTFILENAME%" saved.
  19. echo.&pause&goto:eof
  20. :PRINT_USAGE
  21. echo:
  22. echo USAGE:
  23. echo %~nx0 ^<source dir^> ^<destination dir^> [file name pattern]
  24. exit /b !ERRORLEVEL!