Single script to create multiple directories

Hi ,

I want a script to create a directories at different locations.

suppose i am on home/path/zone1. I want to create a directory of current month in this location.
Then i want to create the same current month directory in home/path/zone2.like this for 9 diffrent zones.

I can do this with below code

cd home/path/zone1 mkdir dirname;cd ../zone2 mkdir dirname  

But i dont want this way bcoz it too lengthy as a script.Could you please provide me a better script to approach.

With bash:

mkdir -p /home/path/zone{1..9}/$(date +%b%Y)

Hi,

I have tried this but no desired result.Also one more thing name of nine zones are AB,BC CD,DF etc.

I fired this script as below

mkdir -p /home/path/{LN}/$(date +%b%Y)

The checked and it had created a directory as {LN} in home/path. could you please help.

monyr=$(date +%b%Y)
for i in AB BC CD DF
do
 mkdir -p /home/path/$i/$monyr
done
1 Like

Many Thanks It worked great.