Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. Get-ChildItem -Recurse -Directory -Path 'D:OlderfilesSourceDocuments' -Filter 'Archive' |
  2. ForEach-Object {
  3. Get-ChildItem -File -Path $_.FullName |
  4. ForEach-Object {
  5. if ($_.LastWriteTime -lt (Get-Date).AddDays(-120)) {
  6. Remove-Item -Path $_.FullName -WhatIf
  7. }
  8. }
  9. }
  10.  
  11. powershell -NoLogo -NoProfile -File "delold.ps1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement