Suppose I have a directory structure like this:$ [~/practice] lsa/ b/ c/ d/Now I want to create a directory tmp1 in all sub directories of practice and I do this:$ [~/practice] mkdir */tmp1mkdir: cannot create directory `*/tmp1': No such file or directoryThen I try the -p switch and I endup with a directory named * with a sub directory tmp1$ [~/practice] mkdir -p */tmp1$ [~/practice] ls*/ a/ b/ c/ d/I know the use of -p switch is to create multiple nonexistent directories. I just thought it might help.How do I create tmp1 in all subdirectories at once? If this can be done, how do I extend it to create \tmp1, \tmp2, \tmp3 in \a, \b and \c at once?Edit: I missed mentioning that the directories don't have to be simple and in order, like a, b, c etc., and the directory to be created is not necessarily like tmp1, tmp2. $ [~/practice] lsdog/ cat/ rat/In them, I would like to have something like$ [~/practice] ls *dog:red/ blue/cat:red/ blue/rat:red/ blue/
How do I create a directory in all subdirectories?
bash;directory;wildcards
With globs :for dir in */; do mkdir -- $dir/tmp1; doneNOTEI treat only dirs (including symlinks to dirs) with the little hack of using */ as a globIf you want to create multiple subdirs at once :    for dir in */; do mkdir -- $dir/{tmp1,foo,bar,qux}; done