针对重要文件有时候需要异地备份,即将一个主机上的文件定时的同步到另一个主机。
set USER=administrator set PASSWORD= set Server1_IP=192.182.1.211 set remoteDataDir=OracleDataBackupjcgm if not exist "D:OracleDataBackupjcgm" mkdir D:OracleDataBackupjcgm set DATADIR=D:OracleDataBackupjcgm set SERVER_ROOT=%Server1_IP%E$\%remoteDataDir% ping -n 1 %Server1_IP% >nul if %errorlevel% equ 0 ( goto updata ) :updata echo make the netbios connection to server net use \%SERVER_ROOT% %PASSWORD% /user:%USER% echo copy MPFTP to local xcopy /d /y /e /q \%SERVER_ROOT% "%DATADIR%" forfiles /p "%DATADIR%" /s /m *.* /d -7 /c "cmd /c del @path" echo client side script finished.
注:将该脚本在备份机上设置为定时任务,就会定时的将远程主机E:OracleDataBackupjcgm目录向备份机同步