Last active
October 11, 2015 03:38
-
-
Save tcshao/3797240 to your computer and use it in GitHub Desktop.
Deleting *.txt files from 'c:\temp' and subdirectories more than 5 days old
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 characters
| <# Deleting *.txt files from 'c:\temp' and subdirectories more than 5 days old #> | |
| Get-ChildItem 'C:/temp' -Recurse -Include '*txt' | |
| | WHERE { ($_.CreationTime -le $(Get-Date).AddDays(-5)) } | |
| | Remove-Item |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment