Skip to content

Instantly share code, notes, and snippets.

@aisuii
Created November 9, 2011 12:20
Show Gist options
  • Save aisuii/1351283 to your computer and use it in GitHub Desktop.
Save aisuii/1351283 to your computer and use it in GitHub Desktop.
ひづけのでぃれくとり
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