Remove end of filename using PowerShell -


is possible use powershell remove end of filename of files in folder? examples:

  • moira_by_kr0npr1nz-d8poqdb.jpg
  • shining_eye___step_by_step_by_ryky-d8pp6xh.jpg
  • redemption___the_hunters_by_danluvisiart-d8oy1ef.jpg

so want remove "by" ".jpg".

how using regex replace so:

get-childitem -filter "*.jpg" | % {     rename-item $_.fullname -newname ($_.fullname -replace '_by_.*\.jpg$', '') }  

if regex doesn't find match file name left unchanged.


Comments

Popular posts from this blog

Java 8 + Maven Javadoc plugin: Error fetching URL -

css - SVG using textPath a symbol not rendering in Firefox -

order - Notification for user in user account opencart -