I wish to remove everything after second occurrence of a dash. No change if there is only one dash in the name.
Example: 1
Original: andy swimming - mandy watching - sandy dancing.jpg
to become: andy swimming - mandy watching.jpg
In this file the name part after second dash, including the second dash, is removed.
Example: 2
Original: andy swimming - mandy watching.jpg
remains as : andy swimming - mandy watching.jpg
No change here because there is only one occurrence of dash in this file name. It would be great if some explanation of the code is also available.
I need help how to do it. I have may files to be renamed in this way.
Thank You