Reputation: 476
I have a server with an incredibly overloaded Windows/Temp folder. So, I wanted to run a simple Powershell script to clear it out (I'm talking tens of thousands of .tmp and .bak files that are over a year old). Below is the code:
Remove-Item C:\Windows\Temp\* -Include .txt,.bak,.tmp -WhatIf
I tried removing the -WhatIf
as well (I just had that in there because I was playing around with some stuff) and nothing happens. It's so simple I'm almost definitely missing something simple.
Upvotes: 1
Views: 580
Reputation: 36
Missing wildcard on the -include:
Remove-Item C:\Windows\Temp\* -Include *.txt, *.bak, *.tmp -WhatIf
Upvotes: 2