defect122

Windows batch - batch backup with xcopy

Feb 17th, 2012
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. @echo off
  2.  
  3. set dir="c:\"
  4.  
  5. for /R %dir% %%f in (*.7z) do (
  6. del %%f )
  7.  
  8. cd /d d:\7-zip\
  9. 7za.exe a -t7z "c:\backup1.%date%.7z" d:\Myfiles -mx=9
  10. echo The folder has been archived and saved to c:\.
  11. echo.
  12. 7za.exe a -t7z "c:\backup2.%date%.7z" c:\Pics -mx=9
  13. echo The folder has been archived and saved to c:\.
  14. echo.
  15. 7za.exe a -t7z "c:\backup3.%date%.7z" "d:\mydocuments" -mx=9
  16. echo The folder has been archived and saved to c:\.
  17.  
  18. cd /d c:\
  19. xcopy *.7z H:\Backups /F /C /Y
  20.  
  21. net use Z: https://server.com /user:abc /persistent:no
  22. start Z:\
  23. explorer /e,C:\
  24.  
  25. pause > nul
  26. exit
  27.  
  28.  
  29. What it does : This batch first deletes all old 7z-backups if there are any to delete and then goes on and compresses three folders using the 7za tool (find via google). Then it copies all three 7z-backups to an SUB flash drive with the letter H. After that it connects to a Webdav server and starts the explorer.
  30. (replace server.com with the correct webdav name and user with the correct user name)
Advertisement
Add Comment
Please, Sign In to add comment