Generate Zeropadded Ranges
Need to generate 100 directories, named 01/
to 99/
? Today I learned that command line brace expansion supports zeropadded (starting with one or more zeroes) ranges. The following command will create 100 zeropadded, numbered directories:
$ mkdir {01..99}
Hit tab to see the expanded command.
The second zeropad, if there is one, can be omitted— the following creates a range of 01-05, even thought there's no zero in front of the 5
:
$ mkdir {01..5}

Which expands to:
$ mkdir 01 02 03 04 05
Tweet