1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00
Files
til/unix/globbing-for-all-directories-in-zsh.md
2016-06-08 08:18:55 -05:00

626 B

Globbing For All Directories In Zsh

Globbing in Zsh is an expressive way to generate filenames for commands. This includes working with directories. If I'd like to run a command against all directories in the current directory, I can employ the *(/) globbing pattern.

$ echo *(/)
one three two

What about all directories in the root directory?

$ echo /*(/)
/Applications /Library /Network /System /Users /Volumes /bin /cores /dev /home /net /opt /private /sbin /usr

You can go ahead and use that with any other command now (e.g. ls).

source