Question

I tried the following command to list all the files which has /SL/src/ in its path

find * -type f -name '*/SL/src/*'

but it does not prints any thing even though there are files within the directory SL/src

Was it helpful?

Solution

You might use something like that:

find * -type d -exec sh -c '
for i do
  [ "$(basename $i)" = src ] &&
  [ "$(basename $(dirname $i))" = SL ] &&
  find "$i" -type f ; done
' sh {} + 

or simply:

find * -type f | grep /SL/src/
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top