Figure out what we'll need to do for making directories
ls --time-style=+%Y-%m -l | cut -c 37- | cut -f 1 -d " " | sort | uniq | perl -ne 'print "mkdir $_"' >> cleanup
Figure out how we're gonna be moving the files around
ls --time-style=+%Y-%m -l | cut -c 37- | perl -pe 'chomp; s/(\d\d\d\d\-\d\d) (.+)/mv \"$2\" $1\n/g' >> cleanup
Ok, so now let's do a sanity check to make sure our changes are good
Looks good, let's make it happen.
chmod +x cleanup; ./cleanup
And we have files in directories ordered by month! Huzzah!
This is a really hackish way of doing things; it's dependant on the files in the directory being within a certain size range and other ickies. But as a one-time cleanup, it'll do the trick.