#!/bin/bash
##copyright@Jason##PathDATE=`date +%Y-%m-%d`##readecho -en "Enter the absolute path to the directory you want to create: "read dir#if Statement to determineif [ -z $dir ];then exit 1;else## Loop to create a directory structurefor i in "$DATE" do Year=`echo $i|awk -F "-" '{print $1}'` Month=`echo $i|awk -F "-" '{print $2}'` Dieser_day=`cal|sed -n '7p'|awk '{print $NF}'`## Determine whether there is in this directory if [ -d $dir/$Year ];then echo " " echo "Warning:" echo "This directory has been created!" exit 1; fi mkdir $dir/$Year## Create two directoriesfor month in `seq $Month 12` do mkdir $dir/$Year/$month## Create three directoryfor day in `seq 1 $Dieser_day` do mkdir $dir/$Year/$month/$dayfor hour in `seq 0 23` do mkdir $dir/$Year/$month/$day/$hourdone done done donefi