Yesterday and today , I started studying shell script .. Mr . Chnadrashekar sir started some basics on
SHELL SCRIPTING .. !! then he gave a small task such that , to make own removing command ..
when we remove a file , i.e deleted file will go to a another directory named RECYCLE .. (like trash) it will have back up of that deleted
file .. This will prevent data loss , when files deleted any other user other than U 🙂
and also , it will store in folder in RECYCLE with date, time as folder name (TIMESTAMP) .. by this we can come to
when file was deleted 🙂
SAVE UR DELETED FILE USING THIS SCRIPT 🙂 🙂
mkdir RECYCLE >/dev/null 2>&1
echo “program name :$0”
mkdir “`date +%d:%m:%y:%H:%M`” >/dev/null 2>&1
if [ $# -lt 7 ]; then
cp $1 $2 $3 $4 $5 $6 “`date +%d:%m:%y:%H:%M`” && rm $1 $2 $3 $4 $5 $6 >/dev/null 2>&1
cp -r “`date +%d:%m:%y:%H:%M`” RECYCLE && rm -r “`date +%d:%m:%y:%H:%M`” >/dev/null 2>&1
echo ” \n WARNING : u are not allowed to delete more than $# at a time !!!!!!! \n ”
and by this script u ll have back up at current directory where u are deleting files !!
so u can make ur own destination directory for RECYCLE (for backups)
i.e I will back up files in my media !! so i have to give
mkdir /media/70CCFA76CCFA35C6/”`date +%d:%m:%y:%H:%M`” >/dev/null 2>&1
it will store in /media/70CCFA76CCFA35C6 … change ur destination path to all lines 🙂
after that alias ur script to ‘rm’ command
Then save your files !!!!
This is my first shell scripting program !!!!