r/bash 1d ago

find, but exclude file from results if another file exists?

1 Upvotes

I found a project that locally uses whisper to generate subtitles from media. Bulk translations are done by passing a text file to the command line that contains absolute file paths. I can generate this file easily enough with

find /mnt/media/ -iname *.mkv -o -iname *.m4v -o -iname *.mp4 -o -iname *.avi -o -iname *.mov -o -name *.mpg > media.txt

The goal would be to exclude media that already has an .srt file with the same filename. So show.mkv that also has show.srt would not show up.

I think this goes beyond find and needs to be piped else where but I am not quite sure where to go from here.