Mahakaal
Mahakaal

Reputation: 2175

How to stop find command from listing folders with dot(.)

In my home dir , i have folders like .cpan .cpcpan and they are also showing.

How i hide them . i am using

find /home -mindepth 1 -maxdepth 1 -type d -printf "%f\n"

Upvotes: 0

Views: 527

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799310

Prune them.

find /home -mindepth 1 -maxdepth 1 -type d \( -name '.*' -prune -o -printf "%f\n" \)

Upvotes: 1

Related Questions