Forum Discussion

AngeloLobo_79's avatar
AngeloLobo_79
Copper Contributor
Jan 05, 2022

Script to delete files older than 7 days / Script para deletar arquivos com mais de 7 dias

Hey guys. I would like some help from you. I'm trying to create a script in powershell to delete files that are more than 7 days old. These files are inside subfolders (YY, WW and AA) in the root di...
  • BenRJ's avatar
    Jan 06, 2022

    AngeloLobo_79

    Get-ChildItem –Path "C:\XX" -File -Recurse | Where-Object { ($_.LastWriteTime -lt (Get-Date).AddDays(-7)) } | Remove-Item

Resources