Move part of the name

Would you like Bulk Rename Utility to offer new functionality? Post your comments here!

Move part of the name

Postby jgt » Thu Apr 07, 2005 9:13 am

I'd like to see the function to move some characters from one position to another. Example I have a series of files similar to "01 - Ray Romano - Everything and a Kite (Disc 1)" and I want to move the string "(Disk 1)" from its current position to the start (position 1) of the file name.
jgt
 
Posts: 1
Joined: Thu Apr 07, 2005 9:07 am

Postby Admin » Thu Apr 07, 2005 10:57 am

Something like this very messy to code, and will take up a lot of screen space. But you can already achieve this functionality very easily using Regular Expressions. See the helpfile for the "Program Files" example. There's also an excellent posting here which discusses regular expressions.
Admin
Site Admin
 
Posts: 1521
Joined: Tue Mar 08, 2005 8:39 pm

Postby Stefan » Thu Apr 07, 2005 1:19 pm

An try on the fly, since i just have a break ;-)



You have:
01 - Ray Romano - Everything and a Kite (Disc 1).txt


You search for:
(\d\d) - ([A-Za-z ]*) - ([A-Za-z ]*)\s(\(([A-Za-z0-9 ]*)\))

Don't need to search/replace the extension in BRU.


Explanation:
(\d\d) = 2 digits > group 1
- = space and -char and space
([A-Za-z ]+) = one or more upper or lower of any char or spaces >group 2
- = space and -char and space
([A-Za-z ]+) = one or more of any char or spaces > group 3
\s = one space
( = beginn of group 4
\( = the char ( himself
([A-Za-z ]+) = one or more of any char or spaces
\) = the char )
) = end of the 4 group



You replace with:
\4 - \1 - \2 - \3


----
Or shorter:
S: (\d\d) - (.+) - (.+)\s(\((.+)\))
R: \4 - \1 - \2 - \3

Or:
S: (.+) - (.+) - (.+)\s(\((.+)\))
R: \4 - \1 - \2 - \3




HTH
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Postby Admin » Thu Apr 07, 2005 1:40 pm

Thank you Stefan :-)
Admin
Site Admin
 
Posts: 1521
Joined: Tue Mar 08, 2005 8:39 pm

Re: Move part of the name

Postby Myrkur » Fri Jun 07, 2013 6:59 pm

Hi guys,
That's a very old topic but I thought not to open a very similar one... I just discovered this great utility and if only I could figure the regexes out, it would help me a lot...! I tried to put together advices from the support but all my attempts failed...
I scanned some class notes and named them e.g. "Scan Pag. 1 - 8 (05.2013)". Unlucky choice, (they're not correctly ordered when in a folder) I would love to move the date in first position.

This came to my mind, but I think the problem is that symbols "." and "-" are not included in "[A-Za-z]". Is that the point? Could you help me, please?

Match: ([A-Za-z ]*)\s(\(\d\d.\d\d\d\d\))
Replace: \2 \1

Thanks a lot to all :D
Myrkur
 
Posts: 2
Joined: Fri Jun 07, 2013 6:25 pm

Re: Move part of the name

Postby Stefan » Fri Jun 07, 2013 7:31 pm

Myrkur wrote:Hi guys,
That's a very old topic but I thought not to open a very similar one... I just discovered this great utility and if only I could figure the regexes out, it would help me a lot...! I tried to put together advices from the support but all my attempts failed...
I scanned some class notes and named them e.g. "Scan Pag. 1 - 8 (05.2013)". Unlucky choice, (they're not correctly ordered when in a folder) I would love to move the date in first position.

This came to my mind, but I think the problem is that symbols "." and "-" are not included in "[A-Za-z]". Is that the point? Could you help me, please?

Match: ([A-Za-z ]*)\s(\(\d\d.\d\d\d\d\))
Replace: \2 \1

Thanks a lot to all :D


FROM:
Scan Pag. 1 - 8 (05.2013)
TO:
2013-05 Scan Pag. 1 - 8

USE:
RegEx(1)
Match: "(.+)\s\((\d\d)\.(\d\d\d\d)\)"
Replace: "\3-\2 \1"


Note:
Don't use the double quotes in real.
Because of the dot in base name, select "Options > Ignore... > File Extensions".
Test always with copies of your real files and be sure to have a backup.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Move part of the name

Postby Myrkur » Sun Jun 09, 2013 11:49 pm

Stefan wrote:
FROM:
Scan Pag. 1 - 8 (05.2013)
TO:
2013-05 Scan Pag. 1 - 8

USE:
RegEx(1)
Match: "(.+)\s\((\d\d)\.(\d\d\d\d)\)"
Replace: "\3-\2 \1"


Note:
Don't use the double quotes in real.
Because of the dot in base name, select "Options > Ignore... > File Extensions".
Test always with copies of your real files and be sure to have a backup.


Thanks, thanks, thanks! Worked great! :P
Myrkur
 
Posts: 2
Joined: Fri Jun 07, 2013 6:25 pm


Return to Suggestions