Skip to content

Instantly share code, notes, and snippets.

@lzehrung
Last active December 10, 2022 07:41
Show Gist options
  • Save lzehrung/23688712b3653b8cde0640ffc87ee04d to your computer and use it in GitHub Desktop.
Save lzehrung/23688712b3653b8cde0640ffc87ee04d to your computer and use it in GitHub Desktop.
Find all child files modified in the last day and remove them (ignoring errors and confirm prompts)
Get-ChildItem -Recurse -Filter *.csv | Where-Object {$_.LastWriteTime -gt (Get-Date).AddDays(-1)} | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment