I need a powershell line to delete all files in a folder excluding xml files.
Foldername:
d:\apps\Que
Subfolders should not be deleted
Thanks
CodePudding user response:
Remove-Item supports native exclusion:
Remove-Item "d:\apps\Que\*" -Exclude *.xml
use -WhatIf
to check what would be deleted without actually deleting it.