【OS_Windows】Windows主机之间远程拷贝文件
针对重要文件有时候需要异地备份,即将一个主机上的文件定时的同步到另一个主机。
set USER=administrator set PASSWORD= set Server1_IP=192.182.1.211 set remoteDataDir=OracleDataBackup\jcgm if not exist "D:\OracleDataBackup\jcgm" mkdir D:\OracleDataBackup\jcgm set DATADIR=D:\OracleDataBackup\jcgm 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:\OracleDataBackup\jcgm目录向备份机同步