Deleting the old Transaction Log backups

  • Hi,

    In one of our DR Servers we have configured Custom Logshipping. In the folder where the .TRN files are getting copied there is a script to purge the files which are older than one day. Following is the code for the same.

    @Echo Off

     if exist filelist del filelist

     date /t > rundate

     for /f "tokens=2* delims= " %%i in (rundate) do set rundate=%%i

     for %%i IN (*.trn) do echo >> filelist %%i %%~ti

     for /f "tokens=1,2* delims= " %%i in (filelist) do if not %rundate% equ %%j del %%i

    :pause

    :Exit

    Instead of removing the files older than 1 day, I need to keep 3 days transaction logs.

    Being a novice I don't have much idea how to accomlish it. Can anybody help me with this?

    Many thanks in advance,

    Sandhya

  • You may use vbscript, which has datadiff function, and combined with the object, filesystemobject.scripting.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply