Removing part of filename
<p>I am trying to remove part of a filename after a specific character. I have had a look around but can't seem to find a suitable answer.
Each filename is unique expect for a - in the middle.</p>

<p><b>Current Filenames;</b></p>

<pre><code>somefilename - somefilenamewithmore
somefilename123 - somefilenamewithmore123
somefilename5555 - somefilenamewithmore5555
</code></pre>

<p><b>What I want it to be;</b></p>

<pre><code>somefilename 
somefilename123 
somefilename5555 
</code></pre>

<p><br>
Fore reference files are located in <code>C:\users\%username%\rename</code></p>

<p>I have found plenty of info on removing a specific number of characters or removing something specific from the filename, but not having any luck trying to remove everything after a certain character.</p>

<p>Any help/pointers would greatly be appreciated</p>