Bash Brace Expansion Create directories to group files by month and year


Example

$ mkdir 20{09..11}-{01..12}

Entering the ls command will show that the following directories were created:

2009-01 2009-04 2009-07 2009-10 2010-01 2010-04 2010-07 2010-10 2011-01 2011-04 2011-07 2011-10
2009-02 2009-05 2009-08 2009-11 2010-02 2010-05 2010-08 2010-11 2011-02 2011-05 2011-08 2011-11
2009-03 2009-06 2009-09 2009-12 2010-03 2010-06 2010-09 2010-12 2011-03 2011-06 2011-09 2011-12

Putting a 0 in front of 9 in the example ensures the numbers are padded with a single 0. You can also pad numbers with multiple zeros, for example:

$ echo {001..10}
001 002 003 004 005 006 007 008 009 010