Is it possible to look for files using find
and match only one in a given directory (no matter which) and ignore the rest?
Here’s an example of a dir struct:
A/
├─ foo_a1
├─ foo_a2
├─ foo_a3
C/
├─ D/
│ ├─ B/
│ │ ├─ foo_b1
│ │ ├─ foo_b2
├─ E/
│ ├─ foo_e1
│ ├─ foo_e2
I hope to get the following list:
A/foo_{a1 XOR a2 XOR a3}
C/D/B/foo_{b1 XOR b2}
C/E/foo_{e1 OR e2}
I can match every file starting with foo and then post-process results but I’m wondering if there is any way to do it using find
only. Please note after foo
any pattern may occur.