If you're interested in using SQL Server to delete your old backup files without
using xp_cmdshell, you could look into master.dbo.xp_delete_file
exec
master.dbo.xp_delete_file
0, --File type [(0) FileBackup | (1)
FileReport]
N'<folderPath>', -- Folder path to look
in
N'<ext>', --File extension to be deleted (do not precede with a
period)
N'<date>', --Date line. All files meeting criteria created
before this date will be deleted
1 -- Subfolder flag. Indicates to delete
from subfolders [ 1 | 0 ]
keep in mind this procedure is undocumented and
not supported, use at your own risk.
I use it and it works fine for deleting
native sql backups. This procedure is what is run when a maintenance task for
deleting backup files is scripted. Please do plenty of testing before
implementation
转载于:https://www.cnblogs.com/Henry1225/archive/2012/05/05/2484718.html