David542
David542

Reputation: 110143

Find -type f with restrictions

I have the following find command to find all files in a Volume:

find ./ -type f

How would I exclude all files that start with . ? Also, I do want to include folders that being with . For example:

What would be the correct find command for this?

Upvotes: 18

Views: 89621

Answers (1)

Eric
Eric

Reputation: 2116

To exclude all files whose names begin with . :

find ./ -type f ! -name '.*'

This will search in all directories (even if their names start with a dot), descending from the current directory, for regular files whose names do not begin with a dot (! -name '.*').

Upvotes: 25

Related Questions