About the author
I recently noticed that my SQL backup files were not getting deleted, and after some research, found the commands to delete old backup files.
Xp_delete_file take five parameters:
EXECUTE master.dbo.xp_delete_file 0, N'FullDirectoryName, not including backslash', N'bak', N'cutoff date and time'
where the cutoff date and time is YYYY-MM-DD HH:MM:SS.
An example of this looks like,
EXECUTE master.dbo.xp_delete_file 0, N'C:\BACKUP\BlogDirectory', N'bak', N'2019-12-01 00:00:00'
This command needs to be executed in SQL Management Studio, after right clicking on the correct database, and clicking New Query.