February 23, 2018

Creating Sequential Directories

There’s an easy way to create a number sequence directories. This is useful when your creating directories for days of a month. I did this for a while organizing blog postings.

To create ten directories starting with the number 21:

mkdir {21..31}

If you need to create a directory with a leading zero:

mkdir $(printf "%02i " $(seq 1 20))

To do a directory in this format: MM-DD Simple use this:

mkdir $(date ‘%b-%d’)

Hope this gives people ideas on different ways to create directories.

Comments

Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!