• One way would be to switch to PowerShell.

    $path = '\\server\path'

    $filter = '*.bak'

    $retentionDate= (Get-Date).AddHours(-12)

    #################################################

    Get-ChildItem (Join-Path $path $filter) -Recurse |? {($_.PSIsContainer -eq $false) -and ($_.LastWriteTime -lt $retentionDate)} | Remove-Item -WhatIf

    Just remove the -WhatIf from the code when you're ready for it to do work.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato