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: 1022
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


Return to How-To