With zsh:
print -rC1 -- **/*(N/)
(zsh globs skip hidden files by default).
Or to do anything with those dirs:
for dir (**/*(N/)) anything with $dir
or, if anything can take more than one file at a time, with GNU xargs or compatible:
xargs -r0a <(print -rNC1 -- **/*(N/)) anything with
POSIXly:
LC_ALL=C find . -name '.?*' -prune -o -type d -print
LC_ALL=C is needed otherwise it would fail to skip hidden dirs whose name contains sequences of bytes that don't form valid character in the user's locale. See also how the order of the predicates makes sure we avoid applying -type d (which potentially involves an extra expensive lstat() system call) on those files whose name starts with ..
That one also outputs . (the current working directory), add a ! -name . before -type if you don't want it or change it to:
LC_ALL=C find . ! -name . \( -name '.*' -prune -o -type d -print \)
Do do anything with the files, replace -print with -exec anything with {} ';' or -exec anything with {} + if anything can take more than one file at once.
-mindepth 1part in your line, I get zero matches. – fich Sep 27 '20 at 18:09., is the first one seen byfind. It is matched by-type -dand-name '.*', hence it is pruned, i.e. is not descended into (nor printed, because-prunesucceeds)..is at depth 0,-mindepth 1preventsfindfrom testing it. – fra-san Sep 27 '20 at 18:14-ois an "or" operation, where if the first argument is true the second argument is not evaluated. – NeilG May 29 '23 at 07:09