Created
November 9, 2011 12:20
-
-
Save aisuii/1351283 to your computer and use it in GitHub Desktop.
ひづけのでぃれくとり
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
year_range=$(seq 2001 2011) | |
month_range=$(seq 01 12) | |
day_range=$(seq 1 31) | |
for y in $year_range; do | |
mkdir -p $y | |
for m in $month_range; do | |
month=`printf '%02d' $m` | |
mkdir -p "$y/$month" | |
for d in $day_range; do | |
invalid=$( date -d "${y}${month}${d}" > /dev/null 2>&1; echo $? ) | |
if [ $invalid -eq 0 ] | |
then | |
date=`printf '%02d' $d` | |
dir="$y/$month/$date" | |
echo $dir | |
mkdir -p $dir | |
fi | |
done | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment