0

I'm using Windows Server 2003, Sql-Server 2005 and 7-zip for archiving.

Each day maintenance plan adds all DBs to backup and i need to archive those but just those files.

How do i create .bat or .vbs script which

  1. deletes previous archive
  2. adds only new (of this day) files to archive, while naming this archive 1sql_020810.7z (date)

I don't need help with 7-zip commands but with dos/vbs. I don't know how to get Current Date and Files of This Day to archive...

Thanks.

John Gardeniers
  • 27,262
  • 12
  • 53
  • 108
eugeneK
  • 410
  • 2
  • 8
  • 18

1 Answers1

0

in you sql server maintenance plan, you can delete the previous backup (however, it won't know anything about your archive)

for /f "tokens=*" %%I in (currentarc.txt) do call :prune %%I
goto :renbackup

:prune
del %1


:renbackup
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set date=%%a-%%b-%%c)

move d:\backup\dbbackup.bak c:\backup\dbbackup%date%.bak
echo dbbackup%date%.bak > currentarc.txt
7z .....  (do your 7zip stuff on the file)

the first part of this batch file deletes the past archive

the second part of the batch file renames the current backup from sql server to one that has a date and adds the file name to a file that you will need the next time. then you can do your compression with 7zip.

note that i didn't test this but the concept should work.

johnh
  • 585
  • 4
  • 9