Posted By

Keef on 07/05/10


Tagged


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

Vordreller
Tyster
thastyle


Server backup


 / Published in: DOS Batch
 

  1. @echo off
  2.  
  3. rem Dependacies (tools need to be in the path variable): 7za.exe, HoboCopy.exe
  4.  
  5. set backupdir=C:
  6. set backuplist=backup_list.txt
  7.  
  8.  
  9. for /f "tokens=1,2,3,4 delims=/ " %%a in ("%date%") do set day=%%a&set month=%%b&set year=%%c
  10.  
  11. mkdir "%backupdir%\%year%-%month%-%day%"
  12. mkdir "%temp%\%year%-%month%-%day%"
  13.  
  14. set logfile="%backupdir%\%year%-%month%-%day%\%year%-%month%-%day%.log"
  15. set archive="%backupdir%\%year%-%month%-%day%\%year%-%month%-%day%.7z"
  16.  
  17.  
  18. for /f "tokens=1-2 delims=," %%a in ('type "%backuplist%"') do hobocopy /r /y "%%a" "%temp%\%year%-%month%-%day%\%%b"
  19. 7za a -t7z "%archive%" "%temp%\%year%-%month%-%day%">>"%logfile%"
  20. rd /s /q "%temp%\%year%-%month%-%day%"

Report this snippet  

You need to login to post a comment.