none
How to delete the zip files 6 days old RRS feed

  • Question

  • How to delete the zip files 6 days old

    I have used the below command, however its not working

    Get-ChildItem -Path $dst_zip -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force

    • Moved by Bill_Stewart Wednesday, February 14, 2018 7:30 PM Unanswerable drive-by question
    Friday, January 5, 2018 10:13 AM

All replies

  • How is it not working?

    $limit = [datetime]::Today.AddDays(-30)
    Get-ChildItem -Path $dst_zip -Include *.zip -File -Force | 
        Where-Object {$_.CreationTime -lt $limit } | 
        Remove-Item -Force
    


    \_(ツ)_/

    Friday, January 5, 2018 10:29 AM