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
Post a Comment