How do you create a job in SQL server 2008 R2 that will clear transaction logs? I have created a maintenance plan in SQL Server 2008 to delete transaction logs backups older than 3 days. Every day I look in the folder designated and the logs are still there. The job states it has run but nothing is removed. Job schedule is recurring with a daily frequency and the status is enabled.

If I copy the Transact-SQL and run it manually, it appears to clear space on the drive even though I don't see the logs removed up to the last 3 days. The transaction logs are saved to a folder on the target drive not the root itself.

Database recovery model is full and this is required due to the nature of the application that run against the SQL Server box. I have tried removing the maintenance plan and recreating it but I'm getting the same results (nothing). I also checked to see if the SQL Server agent isn't tied up on any job.

What am I doing wrong?
You can use Ola Hallengren's  SQL Server Backup Solution.

Especially the CleanupTime will help you to delete the old backups (FULL / Diff or Transaction log backups).


  Specify the time, in hours, after which the backup files are deleted.