怎么实现服务器中的文件差异备份
这篇文章主要讲解了“怎么实现服务器中的文件差异备份”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么实现服务器中的文件差异备份”吧!
10年积累的网站设计制作、成都网站制作经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先建设网站后付款的网站建设流程,更有陕西免费网站建设让你可以放心的选择与我们合作。
使用小巧强大的7z(不到1M),实现差异文件备份.
::This script backup the data from srvdatacn01 ::It's an ancremental backups tools, One base file and diff files for each day. ::The files be deleted at srvdatacn01 are still keep saved at archived diff files, until them be deleted. ::Make sure you DateTime format is "yyyy-mm-dd", which could be use as one filenme(exclude / \ * :) ::Add C:\Program Files\7-Zip\ to environment variables path :: Delete the diff archive files which over 7 days :: Command forfiles doesn't support UNC path, so need map the path to driver first if not exist \\srvdatacn02\d ( NET USE Y: \\srvdatacn02\d ) forfiles /P Y: /M backup_srvdatacn01*diff*.zip /C "cmd /c del /q/f @path" /D -7 NET USE Y: /D call :backup "folder1","folder2","folder3","folder4","folder5" :backup for %%i in (%*) do ( if not exist "d:\backup_srvdatacn01_%%~i_base.7z" ( 7z a "d:\backup_srvdatacn01_%%~i_base.7z" "\\srvdatacn01\%%~i\*" -xr!Thumbs.db -mx9 ) else ( 7z u "d:\backup_srvdatacn01_%%~i_base.7z" "\\srvdatacn01\%%~i\*" -u- -up0q1r2x2y2z0w0!"d:\backup_srvdatacn01_%%~i_diff_%date:/=_%_%time::=_%.7z" -xr!Thumbs.db -mx9 7z u "d:\backup_srvdatacn01_%%~i_base.7z" "\\srvdatacn01\%%~i\*" -up0q0r2x2y2z1w1 -xr!Thumbs.db -mx9 ) ) goto:eof
** forfiles 需要使用盘符映射**
删除N天以前的文件
forfiles /P Y: /M backup_srvdatacn01*diff*.zip /C "cmd /c del /q/f @path" /D -7
将差异文件写入diff包
7z u "d:\backup_srvdatacn01_%%~i_base.7z" "\\srvdatacn01\%%~i\*" -u- -up0q1r2x2y2z0w0!"d:\backup_srvdatacn01_%%~i_diff_%date:/=_%_%time::=_%.7z" -xr!Thumbs.db -mx9
更新基础包
7z u "d:\backup_srvdatacn01_%%~i_base.7z" "\\srvdatacn01\%%~i\*" -up0q0r2x2y2z1w1 -xr!Thumbs.db -mx9
感谢各位的阅读,以上就是“怎么实现服务器中的文件差异备份”的内容了,经过本文的学习后,相信大家对怎么实现服务器中的文件差异备份这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!
新闻标题:怎么实现服务器中的文件差异备份
URL标题:http://lswzjz.com/article/peoepo.html