Windows通过共享目录定期备份脚本

(0 comments)

将远程共享目录映射为本地磁盘,如下:

net use z: \\rometehost\share /user:myuser mypasswd

将远程共享目录中的文件复制到当前主机,并且备份失败时发送邮件通知。备份脚本如下:

net use z: \\rometehost\share /user:myuser mypasswd
del "g:\backup\" /F /q
rd "g:\backup\" /Q

xcopy "z:\backup\" "g:\backup\" /E /I
if errorlevel 1 blat G:\backup\error.txt -s "Backup Error" -t liaojl@liaojl.com

net use /delete z:
Currently unrated

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required