Mr.Glaurung
Mr.Glaurung

Reputation: 596

find command with two different patterns

I have a huge directory with video files and subtitles, now I usually have 3 different subtiles files which is incorrect.

videofilename.srt
videofilename.en.srt
videofilename.sv.srt

English subtitles followed by english subtitles (again) and then swedish. Now my video player will not identify all three since it's two different standards (with and without language).

So I want to delete all files that has videofilename.srt but how the heck do I create a find command for that??

find . -type f -name '*[^\...]\.srt'

Doesn't seems to work.

Help?

Upvotes: 1

Views: 46

Answers (1)

anubhava
anubhava

Reputation: 785266

You can use -regex in find to find files without language part:

find . -regex '\./[^.]*\.srt$'

./videofilename.srt

If you want to ignore all *.en.srt and *.sv.srt then use:

find . -name '*.srt' -not \( -name '*.en.srt' -o -name '*.sv.srt' \)

./videofilename.srt

Upvotes: 1

Related Questions