Artur A
Artur A

Reputation: 297

Using prune and -out with find command could not exclude directory

I have level1//a/0.jpg , level1//b/0.jpg

I want to exclude 0.jpg in b directory and do some sed.... but having this it doesn't work

find level1/ -name 0.jpg -prune level1/b -exec sed ....

enter image description here

Upvotes: 0

Views: 28

Answers (1)

Alexander O'Mara
Alexander O'Mara

Reputation: 60527

I think you've misunderstood what -prune does. It sound like you actually want -not -path like so:

find level1 -name 0.jpg -not -path 'level1/b/*'

Upvotes: 1

Related Questions