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

day=”`date +%m“date +%d“date +%y`”
cd $1
mkdir $folder1

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

add path ./ to your $PATH


now you have the command ready to execute….


[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

run automatic backup on usb as soon as it’s plugged in

[root@saurap /]# cat /proc/scsi/usb-storage/*
Host scsi27: usb-storage
Vendor: Sony
Product: Storage Media
Serial Number: 2A07060549833
Protocol: Transparent SCSI
Transport: Bulk

[root@saurap saurap]# vi /etc/udev/rules.d/pendrive.rules
#BUS=”usb”, SYSFS{serial}=”2A07060549833″, SYMLINK=”Storage\ Media”, RUN+=”/home/saurap/”
SUBSYSTEMS==”usb”, ATTRS{serial}==”2A07060549833″, SYMLINK+=”Storage”, RUN+=”/home/saurap/”

Then create the script for backup as

mount /dev/sdb1 /media/PEN
sleep 3
rsync -zvr /home/saurap/Desktop/mine/ /media/PEN/backup