July 19, 2010 at 2:06 pm
Hi all,
I have a maintenance plan with a "Maintenance Cleanup Task" pointing to a folder on a network drive.
Unfortunately it is not working because I have it pointed to a folder that has several sub-folders which contain the backup (.bak) files. Do I have to create a task for each of the sub-folders or is there a work around I am missing or even a better method for this?
The code is -
EXECUTE master.dba.xp_delete_file 0,'\\serveretworkshare$\folder','bak','2010-05-10T12:00:00',1
July 19, 2010 at 4:02 pm
If you are post SP2, there should be a checkbox to mark subfolders as existing for each database. Or are these not named for the databases?
July 20, 2010 at 8:08 am
Hi Steve,
I am on MSSQL2005 SP2 and the only option I see similar to what you described for the Maintenance Cleanup Task is "Include first-level subfolders" but I would like to include second-level etc.
July 20, 2010 at 9:15 am
I had the same problem few days back...
When I created one mainteneance clean task and pointed to that folder contaning sub folders(wid .bak file) then, the job ran but no .bak file were deleted....
So, I created many different maintenance clean task for each sub folder containing .bak file and then
it deleted all the .bak files...
I guess thats the longer way but it works fine...
Sushant
DBA
Virgin Islands
Regards
Sushant Kumar
MCTS,MCP
July 20, 2010 at 11:44 am
You cannot include second level folders. Only one level deep is how it works.
July 20, 2010 at 12:53 pm
Thanks, I'll create individual tasks in that case.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply