最近公司需要將windows上的erp數據備份到另一臺機器,實現異地備份,找了一些軟件,效果不是很好。這裏通過ftp的方式實現:
1、數據的備份腳本如下:
ECHO OFF
:: Set Date Format
Set Year=%date:~0,4%
Set Month=%date:~5,2%
Set Day=%date:~7,3%
:: Set Path
Set Source_Path=E:\FTP_Finance
Set Destination_Path=D:\Script\FTP_Finace_BAK
Set Destination_Path1=D:\Script\FTP_Finace_BAK\FTP
echo 正在壓縮的目錄%Source_Path%,請稍候...
"C:\Program Files\WinRAR\WinRAR.exe" a -as -r -EP1 "%Destination_Path%\FTP_Finance-%Year%-%Month%%Day%.rar" "%Source_Path%\*.*"
Copy "%Destination_Path%\FTP_Finance-%Year%-%Month%%Day%.rar" "%Destination_Path1%"
Ftp -n -s:"%cd%\Data_AutoUpload.FTP"
Del %Destination_Path1%\*.rar
2、將數據上傳到ftp上的命令:
open 192.168.4.104
user test test
bin
prompt
lcd f:\script\captrue_bak\ftp
mput "*"
bye
exit