0

When I do this

mkdir -p a/b/c
mkdir -p a/d/e
find ./a -path ./a/d -prune -o -type d

I get this:

./a
./a/d
./a/b
./a/b/c

I must be using the prune flag wrong. How do I ignore the directory ./a/d as well from the output of my find?

John
  • 7,343
  • 23
  • 63
  • 87

1 Answers1

0

-prune succeds on ./a/d so that branch succeds and prints, -type d also finds it in in ./a

So, I think you want -false after -prune and -not -path ./a/d after -o.

find ./a  -path ./a/d -prune -false -o -not -path ./a/d -type d 
Jasen
  • 826
  • 6
  • 12