SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


scheduled task


scheduled task

Author
Message
shanila_minnu
shanila_minnu
SSC-Addicted
SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)

Group: General Forum Members
Points: 467 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
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4932 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
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4160 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 Guru
SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)

Group: Administrators
Points: 107491 Visits: 19342
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-Addicted
SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)

Group: General Forum Members
Points: 467 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 Guru
SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)

Group: Administrators
Points: 107491 Visits: 19342
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-Addicted
SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)

Group: General Forum Members
Points: 467 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-Addicted
SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)SSC-Addicted (467 reputation)

Group: General Forum Members
Points: 467 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 Guru
SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)

Group: Administrators
Points: 107491 Visits: 19342
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