1
% 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
manish
  • 111
  • 1

1 Answers1

0

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
Adaephon
  • 543
  • 1
  • 8
  • 8