Hello everyone,
I created a batch script with the help of others and modified it to fit my needs. Anyways the first portion of the script works, it creates the backup, and compress it properly but the issue i am having is trying to delete the .bak file after its been compressed, so All i want to see is the zip file. I have searched long and hard for this answer but can't seem to get it right.
@echo Creating Backup folder located in c:/
mkdir C:\Backups
If exist "C:\Backups" ECHO Directory exists!
@echo Backing up your Database....This may take awhile.....
sqlcmd -S Servername\sqlinstancename -i backupDBscript.sql
SET SQL_Backup_script=C:\Path to file
SET MY_Path=C:\path to backup
set mydate=%date:~4,2%%date:~7,2%%date:~10,4%
for %%x in (*.bak) do cscript "%SQL_Backup_script%\zip.vbs" "%MY_PATH%\%%x" "%MY_PATH%\DB_%mydate%.zip"
del /Q/R "C:\Backups\*.bak"
@pause