I have a directory containing a number of subdirectories. Each of these subdirectories contains a subdirectory which all have the same name. I would like to produce a list of all these files on the command line. So, for example, if I have:
dir1/ file1.txt subdir/ relevant_file1.c relevant_file2.c dir2/ file2.txt subdir/ relevant_file3.txt relevant_file4.java dir3/ subdir/ relevant_file5.cpp irrelevant_subdir/ unimportant_file.txt dir4/ subdir/
I would like to have the following output:
dir1/subdir/relevant_file1.c dir1/subdir/relevant_file2.c dir2/subdir/relevant_file3.txt dir2/subdir/relevant_file4.java dir3/subdir/relevant_file5.cpp
I presume this should not be too difficult using
find, but I not quite been able to figure it out. It's difficult to search for this problem because it is so specific, and just searching for "find file by matching on its path" doesn't produce anything useful.