SQL Server Performance

HOW TO DELETE BACKUP FILES OLDER THAN 2 DAYS USING A SCRIPT

Discussion in 'General DBA Questions' started by Fhatuwani, Apr 14, 2010.

  1. Fhatuwani New Member

    HiAnyone who knows how i can delete my backup files xxxxxx.bk using a script so that i can run it as a job? pls help.
  2. Luis Martin Moderator

    What about using backup wizard to generate a job doing what you want?
  3. kboodu New Member

    I use the forfiles.exe program to help with this on some systems where I can't use the automated job.
    D:utiitylforfiles.exe -pD:MSSQLBackups -m*.bak -d-2 -s -c"CMD /C DEL @FILE"
    It's just a single step in a SQL Agent job.
    It was originally part of the Windows 2000 Resource Kit.
  4. satya Moderator

  5. MichaelB Member

Share This Page