Simple backup script using WinSCP
===================================================
echo off
SET HOUR=%time:~0,2%
SET dtStamp9=%date:~-4%%date:~4,2%%date:~7,2%_0%time:~1,1%%time:~3,2%%time:~6,2%
SET dtStamp24=%date:~-4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%
if "%HOUR:~0,1%" == " " (SET dtStamp=%dtStamp9%) else (SET dtStamp=%dtStamp24%)
cd C:/backup
mkdir %dtStamp%
cd %dtStamp%
mkdir database
mkdir homedir
"C:\WinSCP\WinSCP.com" /command "open root:password@10.1.20.103" "option batch abort" "option confirm off" "option exclude log/" "cd /backup/mysql-daily-backup" "lcd C:/backup\%dtStamp%\database" "get *" "cd /home/" "lcd C:/backup\%dtStamp%\homedir" "get *"
===================================================
0 comments:
Post a Comment