I have a source folder where you can find files with extensions
I want to find all files with
.pc only, since
.pro.c is a generated file from
.pc after preprocessing.
Here is my find expression which is not yet correct:
find source ( ( -name '*.pro.c' ) -a -prune ) -o ( -name '*.c' -a -print )
What is my mistake ?
Can someone help me and explain why I do not get the correct result ?
-prune applies to directories, not files, and instructs
find not to descend into the directory it’s looking at.
You only need to negate a name test:
find source -name '*.c' ! -name '*.pro.c' -o -name '*.pc'
Answered by Stephen Kitt on January 2, 2022
1 Asked on January 9, 2021 by ariana-williams
1 Asked on January 9, 2021 by fenil-shah
4 Asked on January 8, 2021
1 Asked on January 8, 2021 by pieterkeesdejong
3 Asked on January 8, 2021 by user2039379
2 Asked on January 7, 2021 by brykkan
1 Asked on January 7, 2021 by amacnewbie
0 Asked on January 7, 2021 by nicholas-dipiazza
0 Asked on January 6, 2021 by vedant-nandwana
1 Asked on January 5, 2021 by cw-holeman-ii
1 Asked on January 5, 2021 by lus-gustavo-monezi
3 Asked on January 5, 2021 by preet
1 Asked on January 5, 2021 by mike-dank
4 Asked on January 5, 2021
Get help from others!