October 19, 2009 at 5:55 am
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
October 19, 2009 at 6:49 am
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]
October 19, 2009 at 7:15 am
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.
Blog -- LearnSQLWithBru
Join on Facebook Page Facebook.comLearnSQLWithBru
Twitter -- BruMedishetty
October 19, 2009 at 8:17 am
There is a task in the maintenance plans that will do this (maintenance cleanup).
October 19, 2009 at 8:31 am
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
October 19, 2009 at 8:50 am
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/
October 20, 2009 at 2:50 am
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/
October 20, 2009 at 2:50 am
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
October 20, 2009 at 6:55 am
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