Posts

Showing posts from July, 2022

Howto Delete all files within a folder which contain a certain string in Windows using Powershell

If you want to delete files which contain certain string in a folder, you can use the following powershell command. In this example , i am searching for all files which contain the string _thumb in the folder e:\targetfolder and delete it, Get-Childitem -path e:\targetfolder -Filter *.jpg -Recurse | where-object {$_.Name -ilike "*_thumb*"} | Remove-Item -Force -WhatIf //display file to be delete  Get-Childitem -path e:\targetfolder -Filter *.jpg -Recurse | where-object {$_.Name -ilike "*_thumb*"} | Remove-Item -Force  //actually delete the files