19 July, 2010

Automatic script for Zip and delete files

I have a SQL backup directory and wanted a script to auto zip the files and delete them after a succesful zipping.

Here you go (using 7-zip):
==============================
FOR %%f in (*.bak) do (
7z.exe a %%f.7z  %%f
if %errorlevel%==0 (del %%f /q)
)
==============================

easy, no ?

No comments:

Post a Comment