I have a directory with contents like the below example.
I want to search
subdir1, subdir2 & subdir3 for files
testA/*a.txt, testB/*b.txt & testC/*c.txt. I want a list of all subdirectories only where all 3 exist.
In this example, that would be only
subdir1/ subdir1/testA/ subdir1/testA/subdir1-a.txt subdir1/testB/ subdir1/testB/subdir1-b.txt subdir1/testC/ subdir1/testC/subdir1-c.txt subdir2/ subdir2/testA subdir2/testA/subdir2-a.txt subdir2/testB subdir2/testB/subdir2-b.txt subdir2/testC/ subdir2/testC/subdir2-c.txt subdir3/ subdir3/testA subdir3/testA/subdir3-a.txt subdir3/testB subdir3/testB/subdir3-b.txt subdir3/testC/ subdir3/testZ subdir3/testZ/subdir3-z.txt
I want to then get the output in alphabetical order, e.g.:
...and then get only the unique ones
(The need for this exists because I'm using
find at the moment, and the directories are listed out of order. The subdirs also have longer/more complex names.)
How can I do this?
I've gotten so far as to list one type of file, e.g. the
*-a.txt file, like this:
find . -wholename "**/testA/*a.txt
Apologies if the answer already exists somewhere, I looked but couldn't find one. Any advice would be much appreciated.