Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


scheduled task


scheduled task

Author
Message
shanila_minnu
shanila_minnu
SSC Veteran
SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)

Group: General Forum Members
Points: 205 Visits: 572
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
Silverfox
Silverfox
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2740 Visits: 1161
How are you doing your backups atm, scheduled job or maintenance plans.

--------------------------------------------------------------------------------------
Recommended Articles on How to help us help you and
solve commonly asked questions

Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden
Managing Transaction Logs by Gail Shaw
How to post Performance problems by Gail Shaw
Help, my database is corrupt. Now what? by Gail Shaw
Bru Medishetty
Bru Medishetty
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1662 Visits: 1950
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.com\LearnSQLWithBru

Twitter -- BruMedishetty
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36318 Visits: 18752
There is a task in the maintenance plans that will do this (maintenance cleanup).

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
shanila_minnu
shanila_minnu
SSC Veteran
SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)

Group: General Forum Members
Points: 205 Visits: 572
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
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36318 Visits: 18752
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/

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
shanila_minnu
shanila_minnu
SSC Veteran
SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)

Group: General Forum Members
Points: 205 Visits: 572
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
shanila_minnu
SSC Veteran
SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)SSC Veteran (205 reputation)

Group: General Forum Members
Points: 205 Visits: 572
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
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36318 Visits: 18752
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.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search