Scenario / Questions

I need to create folders starting from 00 to 99 (00, 01, 02, 03, etc….) in several hundred places. Is there a single line command that will let me do that?

Find below all possible solutions or suggestions for the above questions..

Suggestion: 1

mulaz’s answer is correct, but many people say seq is evil beacuse most shells will let you do the following

mkdir {00..99}

However in some older versions of bash, 0-9 arent padded, so you would have to do

mkdir 0{0..9} {10..99}

Suggestion: 2

Will this do?

for i in `seq -w 0 99`; do mkdir $i; done

does a loop for numbers 0-99, and “-w” sets the equal width (0 padding for 0-9)

Suggestion: 3

I know this is old, but my recommendation would be:

for i in seq -f %02g 0 99 ; do mkdir $i ; done

the -f %02g ensures it stays at least two characters, such as 00 or 99, and will still allow 3 character numbers past 99 so if you have 100 it will not become 001. It will be 00-99 100 instead of 001-100 such as the -w does.