I’m working on a utility that needs to find specific files in an environment.
I have a filename that I need to determine the location of, however this filename can exist in several different directories.
As an example:
/opt/projectDir/filename
/opt/projectDir/subDir/subsubdir1/filename
/opt/projectDir/subDir/subsubdir2/filename
I can run a find command and get all of these fairly simply with something like
find /opt -iname "*filename*"
However, this would return all three files, for my usecase I only need the two files that are in the subsubdir
The catch is the subsubdir is a unique ID, and I wont know what it is
I was thinking something like
find /opt -iname "/opt/projectDir/*/filename"
But it doesn’t return any results, I was also thinking about regex searching for this, but I just can’t seem to get the expression correct.
Are there any built in commands that can assist in finding these files