Reputation: 4671
I'm trying to find all files that are not up to date compared to CVS. As our CVS structure is broken (it does not recurse well in some directories) I'm trying to work around it with find for now.
What I have now is this:
for i in `find . -not \( -name "*\.jpg" \) -path './bookshop/mediaimg' -prune -o -path '*/CVS*' -prune -o -path './files' -prune -o -path './images/cms' -prune -o -path './internal' -prune -o -path './limesurvey171plus_build5638' -prune -o -path './gallery2' -prune -o -print `; do cvs status "$i" |grep Status ; done &>~/output.txt
But somehow my attempt at excluding images (jpg in this case) does not work, they still show up. Anyone have a suggestion on how to get them out of my results from find?
Upvotes: 3
Views: 508
Reputation: 26086
This is failing for the same reason that mixing boolean AND and OR always fails.
What you're saying here is really (in pseudo-code):
If (
File Not Named '*.jpg' AND
Path Matches './bookshop/mediaimg' AND
Prone OR
Path Matches '*/CVS*' AND
Prune OR
Path Matches './files' AND
Prune OR
Path Matches './images/cms' AND
Prune OR
Path Matches './internal' AND
Prune OR
Path Matches './limesurvey171plus_build5638' AND
Prune OR
Path Matches './gallery2' AND
Prune OR
Print
)
Now, print always returns true, and I think prune does as well, so you see that none of the ANDs matter if any OR matches. The careful application of parentheses will probably yield the results you're after.
Upvotes: 2