#!/usr/bin/env zsh MONTHS=( 01 02 03 04 05 06 07 08 09 10 11 12 ) for Y in `( /bin/ls /Ui )`; do cd /Ui/$Y/ echo "'/Ui/$Y'" for M in $MONTHS; do mkdir -p ./$M/ echo "'/Ui/$Y/$M/'" mv ./*$Y-$M* ./$M/ mv ./*$Y$M* ./$M/ done done