I want to delete 30 days old folder & all sub folder which name start "dba_20200312-0500311 - 123"
# $curDateTime = Get-Date -Format yyyyMMdd-HHmmss, folder save in this date format
$mydays = (Get-Date).AddDays(30)
$path = "E:\share\New folder\"
Get-Childitem -path $path -recurse -force | Where-Object { !$_.LastWriteTime -lt $mydays} | Remove-Item -Recurse -Force -confirm:$false -Verbose
I was using this script but it not delete with the name of folder which is save in date wise.