Skip to main content
added 85 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

OneIf you can guarantee that file and directory names won't contain newline characters, one method is to find all files, then use grep to match only the desired results:

find . -type f | grep '/foo/[^/]*$'

One method is to find all files, then use grep to match only the desired results:

find . -type f | grep '/foo/[^/]*$'

If you can guarantee that file and directory names won't contain newline characters, one method is to find all files, then use grep to match only the desired results:

find . -type f | grep '/foo/[^/]*$'
Source Link
Jim L.
  • 8.8k
  • 1
  • 15
  • 29

One method is to find all files, then use grep to match only the desired results:

find . -type f | grep '/foo/[^/]*$'