Created
July 26, 2021 08:29
-
-
Save manchot0/91c959c45750537e7936a50345af2154 to your computer and use it in GitHub Desktop.
Revisions
-
Timothe created this gist
Jul 26, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ #clean recursively all files older than 180 days in the given path $filterDate = (Get-Date).AddDays(-180).Date Get-ChildItem E:\DIR_PATH -Directory | ForEach-Object { Get-ChildItem $_.FullName -Recurse | Where {$_.lastwriteTime.Date -le $filterDate } | Remove-Item }