scheduled task

  • how can i create a scheduled task to delete some backup files from one folder every day...please can you help me wat command i need to write

  • How are you doing your backups atm, scheduled job or maintenance plans.

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • Assuming you have a "BKUP" Directory in Drive K and the backup files are with the extension .bak and you need to delete all files with .bak in that directory.

    Create a batch file that deletes all the required files.

    Deleting all files with the extension .bak would need a command such as "DEL K:\BKUP\*.BAK".

    You need to create the batch file and have it run in a SQL Server Job scheduled daily.


    Bru Medishetty

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • There is a task in the maintenance plans that will do this (maintenance cleanup).

  • bruhaspathy (10/19/2009)


    Assuming you have a "BKUP" Directory in Drive K and the backup files are with the extension .bak and you need to delete all files with .bak in that directory.

    Create a batch file that deletes all the required files.

    Deleting all files with the extension .bak would need a command such as "DEL K:\BKUP\*.BAK".

    You need to create the batch file and have it run in a SQL Server Job scheduled daily.

    i have a folder named BACKUp inside that there are many subfolders with the name of servers. so will the command "DEL K:\BKUP\*.BAK" delete all the .BAK file of subfolders

  • the name of servers or databases? Are you centralizing backups from multiple servers?

    VBScript/Powershell might be the easiest way. you can write a script to delete files older than some date.

    Here's a VBScript sample: http://itknowledgeexchange.techtarget.com/system-administration/vbscript-to-delete-files-in-a-directory-older-than-x-days/

  • Steve Jones - Editor (10/19/2009)


    the name of servers or databases? Are you centralizing backups from multiple servers?

    VBScript/Powershell might be the easiest way. you can write a script to delete files older than some date.

    Here's a VBScript sample: http://itknowledgeexchange.techtarget.com/system-administration/vbscript-to-delete-files-in-a-directory-older-than-x-days/

  • shanila_minnu (10/20/2009)


    Steve Jones - Editor (10/19/2009)


    the name of servers or databases? Are you centralizing backups from multiple servers?

    VBScript/Powershell might be the easiest way. you can write a script to delete files older than some date.

    Here's a VBScript sample: http://itknowledgeexchange.techtarget.com/system-administration/vbscript-to-delete-files-in-a-directory-older-than-x-days/

    ya we are centralizing all the backups to one server

  • Then I would script something. You can use the Windows Scheduled task to run a VBScript as

    cscript.exe myscript.vbs

    as the command. You can set up loops to run through all folders, and then files, leaving the last .Bak only.

Viewing 9 posts - 1 through 8 (of 8 total)

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