none
Exception Remove-Item RRS feed

  • Question

  • I have this script to delete data from 3 previous months but I would like to add another exception, and that is not to delete the data created or on Friday, Saturday and Sunday.

    Get-ChildItem -Path $Path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime.Month -eq $((Get-Date).AddMonths(-3)).Month }  | Remove-Item -Force

    Sunday, November 22, 2020 3:52 PM

All replies