Deleting files with Command Prompt

Legna

Well-Known Member
How do I delete all files except for those who has the [!] in their file names?

EDIT:

Found a workaround. It's a free program called Bulk File Manager v1.6.
 
Last edited:

Neemobeer

Application and Cloud Security Engineer
Staff member
You could do it in powershell. Suppose you wanted to delete all items in a folder on your desktop named test_dir that do not have a ! in them.

You could run the following.

Foreach ($file in (Get-ChildItem -Path $env:Userprofile\Desktop\test_dir -Recurse -File -Exclude *!*)) { Remove-Item $file.FullName }
 
Top