% zsh --version
zsh 5.0.2 (x86_64-apple-darwin13.0)

% ls -l 
bootstrap/    local_folder/ ssh_confs/    zsh_confs/

I am trying to create a sub directory called "files" inside all the directories in my current folder.. I want to use zsh globbing features..

% setopt extendedglob

% mkdir -pv */files   
zsh: no matches found: */files

% mkdir -pv **/files
zsh: no matches found: **/files

1 Answer 1


Globbing is for pattern matching not for pattern generation: It only returns a list of existing files that match the pattern, not a list of every name that could match the pattern.

*/files just means "any existing entity named 'files' in any directory in current working directory".

You can use globbing to get a list of the directories (and only the directories) in the current working directory by using the / *globbing qualifier:

ls -ld *(/)

In order to create the 'files' subdirectory in every one of them you could use a for-loop:

for directory in *(/); do mkdir "$directory/files"; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.