傳輸文件並刪除腳本

#!/bin/bash
. ~/.bashrc

current_date=`date +%Y-%m-%d`
echo ${current_date}
basepath=$(cd `dirname $0`; pwd)
cd $basepath
BAK=/home/work/daiyuanpei/monitor
if [ "`ls -A ${BAK}`" = "" ];
then
	echo "${BAK} is empty"
else
        echo "${BAK} is not empty"
	scp /home/work/daiyuanpei/monitor/* [email protected]:/home/work/daiyuanpei/monitor
	echo "file move done"
	rm ./monitor/*
	echo "empty folder done"
fi

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章