Through this script , we can take backup of file , folder , any drive etc
Create a folder to take backup . For Example :-
$mkdir ~/backup/
$cd /usr/local/bin/
$vi backup.sh
***********************************************************************************
***********************************************************************************
#!/bin/bash
# A script for backing up any file & folder
# First argument : The directory to be backed up
# Second argument : The location to back-up to.
ORIG=$1
BACK=~/backups/
if [ -e $BACK ]
then
echo "WARNING:$BACK exists"
read -p "Press Ctrl+c to exit or Enter to Proceed:"
fi
cp -av $ORIG $BACK
echo "Backup of $ORIG to $BACK completed at:$(date)"
:wq
************************************************************************************
************************************************************************************
$ chmod 755 backup.sh
$ backup (Path of file & folder Only )
$ cd ~/backup/
$ ls -l ( Your all backup in this folder )
*********************************************************************************
**************************************Enjoy *************************************
*********************************************************************************
Enjoy , if you like my blog . please write the comment .
Ravi Ranjan Kr Singh
If you like my blog than please Donate
No comments:
Post a Comment