Mr.Glaurung Mr.Glaurung - 1 year ago 79
Bash Question

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.

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 but how the heck do I create a find command for that??

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

Doesn't seems to work.


Answer Source

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

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


If you want to ignore all * and * then use:

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download