Skip to main content
2 of 8
`! -name . -prune` being the standard equivalent of `-maxdepth 1 -mindepth 1`. Add `-type f` to avoid `grep` complaining on directories. Adding /dev/null to make sure the filename is always printed. No reason to use ; instead of + here.
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

You can couple find with the -exec argument. example:

find . ! -name . -prune -type f -exec grep /dev/null foo {} +
David Wilkins
  • 1.1k
  • 7
  • 16