I have few files under the current directory,
./a.txt
./b.txt
./dir1/c.txt
./dir1/d.txt
When I execute find . -path './dir1' -prune -o -name "*.txt"
,
as expected, it excludes everything under 'dir1' and prints,
./a.txt
./b.txt
./dir1
now if I switch the sequence of the subexpression and execute find . -name "*.txt" -o -path './dir1' -prune
,
to my understanding, it should have displayed all the files, as -name "*.txt"
subexpression should have matched everything that has .txt extension and just or
them with the following test. Therefore 'dir1' directory contents should not have been excluded. But that's doesn't seem to be the case. Displayed result is same as the previous one.
./a.txt
./b.txt
./dir1
what am I missing here?
My system is ubuntu-20.04. I have skim through the find man page and couldn't find any solution. Other sources in the web didn't provide with any satisfactory explanation either.