Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Deleting backup files older than 2 days

Author  Topic 

satishvsh
Starting Member

41 Posts

Posted - 2008-06-23 : 12:22:55
Friends -
I am looking for a windows script (bat file) to delete backup files which are older than 2 days.

Please provide scripts on this.

Appreciate your support

Cheers :)
Satish

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-23 : 12:55:50
See if this helps
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1704.aspx

Also this is the forum to post workable scripts. If you want to ask questions you should post at relevent forums

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

bugbait
Starting Member

1 Post

Posted - 2008-07-09 : 23:08:31
FORFILES is a standard windows file that will do it for you = selects files and executes a command.
Eg
ForFiles /p "D:\Dumps" /m *.bak /D -2 /c "cmd /c del @path /Q"
This will look in the Dump directory for bak files that are older than 2 days and launch the del command to delete them.
Easy

Power corrupts, absolute power corrupts absolutely. But it rocks absolutely too.
Go to Top of Page
   

- Advertisement -