Exclude specific patterns and directories from Find file names

I am trying to find all files that are not updated compared to CVS. Since our CVS structure is broken (in some directories it is not very well recursive), I am now trying to find it with find.

What I have now:

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 for some reason, my attempt to exclude images (jpg in this case) does not work, they still appear. Anyone have a suggestion on how to get them out of my search results?

+3
source share
1 answer

This happens for the same reason that mixing logical AND and OR always fails.

What you say here is valid (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
)

print true, , , , AND , OR . , , , .

+2

Source: https://habr.com/ru/post/1774944/


All Articles