Consider following directory structure:
$ find m
m
m/f.sh
m/.a
I want to find hidden files in non-hidden directories with:
find . -not -path "*/.*" -and -name "*.*"
.
./m/f.sh
but only f.sh
is found, where I expect to find also .a
. When searching without -not -path
part, all hidden files are found:
find . -name "*.*"
./m/f.sh
./m/.a
How can I specify to search non-hidden directories, but match also hidden files?
To clarify:
./non-hidden-dir/.hidden-dir/.hidden-file
should be found../.hidden-dir/non-hidden-dir/.hidden-file
should not be found.
-not -path
part but with "." pattern for-name
hidden files are displayed as well. Please see edited question../non-hidden-dir/.hidden-dir/.hidden-file
be found? (2) Should./.hidden-dir/non-hidden-dir/.hidden-file
be found?