Bash script to Backup Android SD Card

I just created simple bash script to backup my android sd card phone, you can freely used it with the adjustment according to your phone setting and files you want backup.

#!/bin/bash
# author : rachmat.febrianto@gmail.com
# script to backup content : images and e-book of sdcard 
# for android mobile phone

prog=phone_backup.sh
bkp_source1=DCIM
bkp_source2=e-book
bkp_target=/home/rachmat/backup/`date +%y-%m-%d`
sdcard_dir=/mnt/sdcard
sdcard_dev=/dev/sdd1

function check_dir_dev(){
	echo "Checking existance of $sdcard_dir directory ..."
	if [ -d $sdcard_dir ]; then
		echo "The $sdcard_dir directory exist"
		echo ""
	else
		echo "The $sdcard_dir directory doesn't exist"
		echo "Creating $sdcard_dir directory ..."
		echo ""
		mkdir $sdcard_dir
	fi

	echo "Checking existance of $sdcard_dev block special device ..."
	if [ -e $sdcard ]; then
 		echo "the $sdcard_dev block special device exist"
		echo ""
		mounting
		backup
	else
		echo "the $sdcard_dev block special device doesn't exist"
		echo "please consult to your administrator."	
		echo ""
	exit 1;
	fi
}

function mounting(){
	mount $sdcard_dev $sdcard_dir
	if [ $? == 0 ]; then
		echo "$sdcard_dev mounted on $sdcard_dir"
	else
		echo "Error with error code $?"
	fi
}

function backup(){
	echo "Backup start, please wait for a while ..."
	mkdir $bkp_target
	cp -r $sdcard_dir/$bkp_source1 $bkp_target
	cp -r $sdcard_dir/$bkp_source2 $bkp_target
	chown -R rachmat:rachmat $bkp_target
	umount $sdcard_dir
	echo "Backup finish, please check $bkp_target directory"
}

case "$1" in 
	backup)
		check_dir_dev;;
	*)	echo "usage: $prog {backup}"
esac