I managed to modify a script which will take backup with time frame.
--Full backup using datetime file name
DECLARE @devname varchar(256)
DECLARE @DirLocationPre varchar(256)
DECLARE @DatabaseName varchar(256)
SET @DirLocationPre = 'D:\DBName\'
SET @DatabaseName = 'DBName'
SELECT @devname = @DirLocationPre + @DatabaseName + '_' + 'db' + '_' + REPLACE(REPLACE(REPLACE(CONVERT(Varchar(40), GETDATE(), 120),'-',''),':',''), ' ', '') + '.bak';
BACKUP DATABASE @DatabaseName to DISK = @devname
GO
Now, i need a script which can delete backups older than 2 days. Can someone help me please