Last Updated: February 25, 2016
·
1.104K
· jonDowdle

Create striped folders in Bash

If you ever need a hierarchy of folders like the following just use bash's built in expansion to do this in one command.

Striped Folders

This command will create 3 levels of directories, each having folders 0 to 9.

mkdir -p {0..9}/{0..9}/{0..9}

Using mkdir's -p flag allows the child (and grandchild) directories to be created without the parent necessarily being created. The {0..9} is one of bash's normal expansion characters and it expands to the range 0 to 9.

2 Responses
Add your response

Clever... I'm a fan of parameter expansion with bash shell Never thought of using it this way before.

over 1 year ago ·

yes, this is really good.

over 1 year ago ·