Reputation: 17
I'm a virgin to this whole CMD scene. I can really use some help. I just want to delete the file after it converts. Heres what I have so far: update: I figured how to delete after conversion, but its after everything is converted, I want to delete the file RIGHT AFTER EACH CONVERT...
dir/b/s *.mkv >mkvlist.txt
for /F "delims=;" %%F in (mkvlist.txt) do ffmpeg.exe -i "%%F" -vcodec copy -acodec copy "%%~dF%%~pF%%~nF.mp4"
del mkvlist.txt del *.mkv
Upvotes: 1
Views: 10979
Reputation: 21
CMD use && chars to run command if previous completed successfully. For example I use the following
for %i in (*.avi) do ffmpeg -sn -y -i "%i" -c:v libx265 -c:a aac "%~ni.mp4" && del /f/q "%i"
Code all avi files in folder and delete source file after successfull.
Upvotes: 1
Reputation: 70951
There is not any need for the temporary file. Just use a recursive for
command, and for each file found, convert it and remove source if the output file exists and no error was reported
for /r %%F in (*.mkv) do (
ffmpeg.exe -i "%%F" -vcodec copy -acodec copy "%%~dpnF.mp4"
if not errorlevel 1 if exist "%%~dpnF.mp4" del /q "%%F"
)
Upvotes: 5