Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jesselawson/6407233782659a709c4d0029c808d0aa to your computer and use it in GitHub Desktop.
Save jesselawson/6407233782659a709c4d0029c808d0aa to your computer and use it in GitHub Desktop.
Powershell - Remove all files where filename contains string
$string = "MyString"
get-childitem | where-object {$_.Name -like "*$string*"} | foreach ($_) {remove-item $_.fullname}
@matrixglitch
Copy link

Thanks works a treat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment