3 ms·
There are a lot of times one only wants non-dotfiles in the current directory. The find would be something like find . -not -path '*/\.*' -type f -depth 1
by tzs 5y ago
There are a lot of times one only wants non-dotfiles in the current directory.
The find would be something like
find . -not -path '*/\.*' -type f -depth 1
What advantages does that have over 'ls' for that case?
- jasode 5y ago>What advantages does that have over 'ls' for that case? The gp was talking about issues with piping from "ls |" and your particular case of "find" being more convoluted than "ls" isn't comparing that. Example of the topic that gp was warning about: http://mywiki.wooledge.org/ParsingLs http://mywiki.wooledge.org/ParsingLs https://unix.stackexchange.com/questions/128985/why-not-parse-ls-and-what-to-do-instead/129120#129120 https://unix.stackexchange.com/questions/128985/why-not-pars... [Also fyi... you may have meant "-maxdepth" instead of "-depth" in your example.]
- revscat 5y agoFYI the zsh glob for this is `^.*`, e.g.: echo ^.* will show all non-dotfiles in the current directory.
- inshadows 5y agoIn my Zsh echo * does not expand dotfiles. I guess there's some setopt for that.
- revscat 5y agoYou're right. Bored during meeting, go this to work: echo (*)#.* This prints all dot files and regular files in the current directory. You do need to have `setopt EXTENDED_GLOB` somewhere in your zsh config.