January 17, 2012 at 12:47 pm
It seems to be a powerful script . i tried on local machine and it has deleted all backup files.
so u mean to say if i want to delete 7 day older backup t-log backup files only i have to put 7 instead of 5?
I just want to delete T-log backup file so how i can set in script?
WHERE a.backup_start_date
< GETDATE()-5
January 17, 2012 at 12:51 pm
Yes change the 5 to a 7
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
January 17, 2012 at 1:01 pm
Thanks Jason
any idea about to specify path for t-log backup file.
my t-log backup file is on network drive.
March 7, 2012 at 11:12 am
i am trying your SP and it's not deleting the old file..
can you explain in detail if have to setup differently?
Thanks
March 7, 2012 at 12:36 pm
Here's an alternative
http://www.sqlservercentral.com/articles/Integration+Services+(SSIS)/87652/
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 2, 2012 at 11:48 pm
use "forfiles" with xp_cmdshell and it will serve your purpose
forfiles [/p <Path>] [/m <SearchMask>] [/s] [/c "<Command>"] [/d [{+|-}][{<Date>|<Days>}]]
http://technet.microsoft.com/en-us/library/cc753551(v=ws.10)
Musab
http://www.sqlhelpline.com
December 6, 2012 at 11:32 am
I hope you don't mind but I posted this about you on facebook 🙂
"I like this guys code very robust and feature complete....."
January 14, 2015 at 2:29 pm
This is an old thread, but here is the solution for using a UNC path for anyone searching and finding this:
exec xp_cmdshell 'PushD "\\UNCPath" &&(forfiles /m FileName*.* /d -180 /c "cmd /c del @FILE") & PopD'
\\UNCPath is the complete UNC Path of the directory you are searching for
FileName*.* is the file name you are searching for. Use Search arguments such as *
-180 is the number of days to keep
Francis
-----------------
SQLRanger.com
Viewing 8 posts - 46 through 52 (of 52 total)
You must be logged in to reply to this topic. Login to reply