Delete the prefix and hyphen from multiple files?

Bulk Rename Utility How-To's

Delete the prefix and hyphen from multiple files?

Postby letterman » Fri Jul 30, 2021 8:00 pm

Hello,

I have a lot of files in the format of three letters, four numbers and a hyphen, for example:

LYJ1598 - filename
LYJ1599 - filename
LYJ1600 - filename
LYJ1601 - filename
LYJ1602 - filename

etc

As you can see, each of the prefixes are different. Is there a way in which I can batch rename all the files, for example:

"LYJ1601 - filename" to just "filename"

Thanks!
letterman
 
Posts: 3
Joined: Fri Jul 30, 2021 7:57 pm

Re: Delete the prefix and hyphen from multiple files?

Postby therube » Fri Jul 30, 2021 8:06 pm

1:RegEx, enable Simple
Code: Select all
Match:  %1 - %2
Replace:  %2

That should remove everything up through & including the first instance of " - ".
therube
 
Posts: 1310
Joined: Mon Jan 18, 2016 6:23 pm

Re: Delete the prefix and hyphen from multiple files?

Postby letterman » Fri Jul 30, 2021 8:21 pm

therube wrote:1:RegEx, enable Simple
Code: Select all
Match:  %1 - %2
Replace:  %2

That should remove everything up through & including the first instance of " - ".


Thank you for your quick reply! I am new to the software so am just getting to grips with it.
I have just noticed that some of the files have another " - " in them for example:

"LYJ1601 - filename - morefilename"

Would your instructions still work? I just want to be sure before trying it out. Thank you
letterman
 
Posts: 3
Joined: Fri Jul 30, 2021 7:57 pm

Re: Delete the prefix and hyphen from multiple files?

Postby letterman » Fri Jul 30, 2021 8:27 pm

I just realized I can use the 'Remove function' to get rid of the first few letters and numbers so I think this can work too.
letterman
 
Posts: 3
Joined: Fri Jul 30, 2021 7:57 pm

Re: Delete the prefix and hyphen from multiple files?

Postby GayeNT » Fri Mar 11, 2022 12:57 pm

therube wrote:1:RegEx, enable Simple
Code: Select all
Match:  %1 - %2
Replace:  %2

That should remove everything up through & including the first instance of " - ".


THANK YOU SO MUCH FOR THIS - I have just spent 5 hours highlighting and removing the words up to and including the hyphen in my music folders and then I thought surely there has to be a simpler way.
Note to self ask Online Forum FIRST
thank you :shock: :D
GayeNT
 
Posts: 8
Joined: Sun May 30, 2021 10:13 am


Return to How-To


cron