Creating a new subdirectory in multiple existing directories

I am trying to figure out an elegant way to create a new subdirectory in a series of existing directories.

I have 15 already created directories called Week1 through Week15. Within those directories, I'd like to create a new directory called "Assignments." I'm thinking this might require a loop of some kind, but outside of that I'm a little lost.

I know I can "cd" into each directory and then "mkdir Assignment" and repeat this step for all 15 directories, but I know there must be an easier way.

Any help/advice will be greatly appreciated!


You can do it without a loop:

mkdir -p Week{1..15}/Assignments

There are a few ways - try using this loop:

for i in {1..15}; do mkdir Week$i/Assignments; done

You could also cheat at the Week folders - use this:

for i in {1..15}; do mkdir Week$i; done

Just for future reference - if you need to do something similar.