I have multiple folders each one include the following
- a video file
xFilename.mp4
- a folder named
Subs
, which include many srt filesxFilename.srt
.
How can I use bash
to execute an mkvmerge
command for each folder to merge each mp4 file with all the srt files in its Subs
folder and output an mkv file with the same name as the mp4 file.
Something like
for dir in ./* : if (there is an mp4 file) : name = "mp4 file name without the extension, dunno how to do that" mkvmerge -o ./"$dir"/"$name".mkv ./"$dir"/"$name".mp4 "$dir"/Subs/*.srt
How to write that in the terminal?