Mkdir but better: with date stamp on created dir

Linux takes care of date modified on files and folders, so i played around shell scripting to create my own where i can create dirs with date stamp on them. This is how it works.

mkdatedir <path> <directory name>

step by step

[saurap@saurap /]# vi mkdatedir

#!/bin/bash
day=”`date +%m“date +%d“date +%y`”
folder1=”$2″”$day”
cd $1
mkdir $folder1

save the file and create a symbolic link of it on /sbin

add path ./ to your $PATH

viola

now you have the command ready to execute….

example

[root@meadow cloud]# ls
a b c d e f g h i lost+found m n
[saurap@saurap cloud]# mkdatedir /cloud saurap
[saurap@saurap cloud]# ls
a b c d e f g h i lost+found m n saurap112111

Advertisements

About ratotopi
Nepalinux

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

%d bloggers like this: