Jean
Jean

Reputation: 22675

Ignore directories while Unix find

I was trying to make Unix "find" not to list the directories while searching for a particular file.

find  <path> -name filename <Dont't list matching directories>

Upvotes: 1

Views: 971

Answers (3)

gwecho huang
gwecho huang

Reputation: 599

  • find -name filename -type f OR
  • find -name filename -not -type d

Upvotes: 0

don_jones
don_jones

Reputation: 852

find  <path> -name filename ! -type d

Upvotes: 4

ankit
ankit

Reputation: 3358

You can use the -type argument, so you probably want to include -type f to match only files.

Upvotes: 3

Related Questions