thevoipman
thevoipman

Reputation: 1833

linux find prune

I am trying to exclude two directories; vntvdone and downloading, but for some reason, my command still goes in there and outputs the file within it:

find -name '*.avi' -o -name '*.mkv' -o -name '*.mp4' -o -name '*.VOB' -o -path './downloading' -prune -o -path './vntvdone' -prune

I am also running into problems where if a folder/directory that has .mp4 in it, it also gets treated as a file as well... how can we do this search only for files and not folders?

Upvotes: 1

Views: 1121

Answers (1)

suspectus
suspectus

Reputation: 17258

I find it easier to use ! than use prune. I've assumed the starting path for find is '.' The example omits it.

find . \( -type d -a ! -name 'downloading' -a ! -name 'vntdone' -a ! -name '.' \) -o -name \*.avi -o -name \*.mkv -o -name \*.mp4 -o -name \*.VOB 

Upvotes: 2

Related Questions