I need to find a way to delete everything after the third .bak file in the SQL Server backup folder
Working with an old SQL Server cluster with limited space available. The cluster uses a database of SAS (server database 2003) for data backup: fc_mdt
, fc_mdt_trend
, fc_adt
. Inside these folders are several files .bak
and .trn
.
I am looking for a way to automate deleting everything after the third file .bak
when the contents of the folder are specified by the date modified
+3
source to share
2 answers