I'm trying to figure out how delete the files in multiple filtered folders from the Get-Childitem cmdlet.
What i want is find all folders with the name "Cache" in a specific path (Get-Childitem). Then remove the files inside that Cache folder.
Powershell version: 5.1
The code below is not working probably, maybe bad wildcard choice etc.?
Get-ChildItem "$env:LOCALAPPDATA\" -recurse -Filter "Cache\*" | foreach ($_) {remove-item $_.fullname -WhatIf -recurse}
Hopefully someone can help me out, I'm kind of noob in this area :)
Thanks!