这篇文章主要讲解了“怎么实现服务器中的文件差异备份”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么实现服务器中的文件差异备份”吧!
使用小巧强大的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 需要使用盘符映射**
forfiles /P Y: /M backup_srvdatacn01*diff*.zip /C "cmd /c del /q/f @path" /D -7
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
感谢各位的阅读,以上就是“怎么实现服务器中的文件差异备份”的内容了,经过本文的学习后,相信大家对怎么实现服务器中的文件差异备份这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。