title: Delete Certain Files in Folders using Powershell
body: <p>I want to delete certain files in my Folder using Powershell.
  The Script should be able to differentiate between the filenames and only delete the matching files</p>
  <p>The Code I've got so far:</p>
  <pre><code>Get-ChildItem *.mkv | where BaseName -notlike '*`[HEVC]'| foreach {
  ffmpeg -i $_ -c:v libx265 -c:a copy -x265-params crf=25 &quot;$($_.BaseName) [HEVC].mkv&quot; -n
  }
  </code></pre>
  <p>Note that this is the code to encode the files. After the video is encoded, I want to delete the original file.</p>
  <p>I tried using Remove-Item, but I can't figure out how to configure it.
  Additionally (this has nothing to do with the deletion of the files), I tried changing this part:</p>
  <pre><code> &quot;where BaseName -notlike '*`[HEVC]'&quot; to something like &quot;where BaseName -notlike '*`[HEVC]' or [Date1]`*'&quot;
  </code></pre>
  <p>so that it can exclude files with [Date1] and [Time1] at the beginning of the video name, but I can't figure out how to do it, as my PowerShell knowledge is still limited.</p>
  <p>Any Answers or tips are appreciated, I'll try to respond as soon as I can.</p>