Posted in bash

Make a Directory with Actual Date

For different workflows I like to have directories with the actual date as name. To this end I created a little bash function called mkdd (make date directory), which I put into my .bashrc:

mkdd ()
{
    D=$(date '+%F')
    mkdir $D
    cd $D
}

This function creates the directory with the actual date in ISO format and changes into it:

$ pwd
/home/maker/tmp
$ mkdd
$ pwd
/home/maker/tmp/2017-04-09
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s