how to correctly use prune? -type d and -type f have a different effect on prune?

When I use

find . -type f -path ./source/script -prune -o -print;

I get files in the "pruned" ./source/script directory.


But when I use:

find . -path ./source/script -prune -o -type f -print;

the files in the "pruned" directory are omitted:


In another example I see:

find . -type d \( -path dir1 -o -path dir2 -o -path dir3 \) -prune -o -print

The only difference I see with mine is that the -type d is in my code -type f.

Is that the only reason why -prune is ignored and the find program searches inside the "pruned" directory?


find . -type f -path ./source/script -prune -o -print;

is interpreted as

find . (-type f AND -path ./source/script AND -prune) OR (-print);

find . -path ./source/script -prune -o -type f -print;

is interpretted as

find . (-path ./source/script AND -prune) OR (-type f AND -print);

Note that -print and -prune are expressions that evaluate to true.

So if (-path ./source/script AND -prune) is true then (-type f AND -print) is not evaluated and -print is not called. And `(-path ./source/script AND -prune) is true for all the files and subdirectories of ./source/script

Need Your Help

spring @PostConstruct not firing in JBoss7

java spring jboss7.x

I am having trouble after updating an application that runs in WebSphere and Netweaver to run in JBoss6.2 EAP.

UIImageVIew crop Image center according to ImageView size

ios objective-c uiimageview autolayout

I'm trying to create a UIImageView that will have a fixed size (i'm not using auto layout) and content image inside it will be centred.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.