We can use xp_delete_file command to delete older backup files. The command has a parameter to delete files from subfolders as well.
However, it cannot delete files from nested subfolders, but only one level down.
Example: The below code deletes backup files older than 180 days.
declare @backupdeletedate datetime = dateadd(day,-180,getdate())
declare @backuplocation varchar(200) = 'E:\temp\backups'
declare @fileextension varchar(10)='bak'
declare @deletesubfolder tinyint =1 --0 = no subfolders
declare @filetype tinyint=0 --1 = report files
EXECUTE master.dbo.xp_delete_file @filetype,@backuplocation,@fileextension,@backupdeletedate,@deletesubfolder