I have a folder where I need to delete all files and folders except a small list of files and folders.
I can already exclude a list of files, but don\'t see a way to
I used this, that works perfectly for me
Get-ChildItem -Path 'C:\Temp\*' -Recurse | Where-Object {($_.FullName -notlike "*windirstat*") -and ($_.FullName -notlike "C:\Temp\GetFolderSizePortable*")} | Remove-Item -Recurse