Shell根据年月日创建文件夹

#!/bin/sh
dir_path="/vol/project/log/test/"

for year in {2012..2013}
do
    #echo "$year"
    cd $dir_path
    mkdir $year

    for month in {1..12}
    do
        #echo "$month"
        month_dir="$dir_path/$year"
        cd $month_dir
        mkdir $month

        for day in {1..31}
        do
            #echo "$day"
            day_dir="$dir_path/$year/$month"
            cd $day_dir
            mkdir $day

        done
    done
done

 

posted @ 2015-07-24 16:50  Adtuu  阅读(1212)  评论(0编辑  收藏  举报