its very simple code for cmd but i cant get how its should work on my nas with shell
Please help to convert script:
@echo off
setlocal enableextensions enabledelayedexpansion
Settings
set sWorkFolder=d:\workfolder
set sSourceFolder=%sWorkFolder%\waiting-to-convert
set sDestFolder=%sWorkFolder%\done
set sBackupFolder=%sWorkFolder%\trash
set sPath2ffmpeg=%sWorkFolder%\ffmpeg\bin\ffmpeg.exe
Start cycle
for /r "%sSourceFolder%" %%i in (*.mp4) do call :action "%%i"
endlocal
exit /b
:action
setlocal enableextensions enabledelayedexpansion
set "sSourcePath=%~dp1"
set "sDestPath=%sDestFolder%!sSourcePath:%sSourceFolder%=!"
if not exist "%sDestPath%." md "%sDestPath%"
set "sDestFile=%sDestPath%%~n1.720p%~x1"
"%sPath2ffmpeg%" -i "%~f1" -vcodec h264 -vf "scale=trunc(oh*a/2)*2:min(720p\,ih)" -b:v 2000k -preset faster -acodec copy -y "%sDestFile%"
set "sBackupPath=%sBackupFolder%!sSourcePath:%sSourceFolder%=!"
if not exist "%sBackupPath%." md "%sBackupPath%"
move /y "%~1" "%sBackupPath%"
endlocal
exit /b