how to???

Post any Bulk Rename Utility support requirements here. Open to all registered users.

how to???

Postby JEPEDEWE » Thu Oct 25, 2012 7:41 am

Hi I have folling filename:

Anja de Crom - Villa Volta.epub

This should be

de Crom, Anja - Villa Volta.epub

this for about 1000 filenames, all from different authers, so different names, diffezrent lenghts

Thanks
JEPEDEWE
 
Posts: 9
Joined: Mon Apr 25, 2011 8:15 am

Rearrange words and add comma

Postby Stefan » Thu Oct 25, 2012 11:36 am

Hi there, please take some time to use an meaningful subject so i can see that you are a human!


JEPEDEWE wrote:Hi I have folling filename:

Anja de Crom - Villa Volta.epub

This should be

de Crom, Anja - Villa Volta.epub

this for about 1000 filenames, all from different authers, so different names, diffezrent lenghts

Thanks



Please provide first a valid pattern-rule for all of your files.

Taken your example the rule would be:
* Take first word and move it after the third word (OR, right before the first dash)
* add a comma after the second word
This can be done with an RegEx command.

If your file names not always have three parts/words before the first dash,
think about an other rule, or separate your files into groups and rename them with different rules.


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

Re: how to???

Postby JEPEDEWE » Thu Oct 25, 2012 3:29 pm

I'm human... except I couldn't find a nice and clear subject

When I go to RegEX I see Match en replace....
Could you please provide an example how it should be done??? I'm far from an expert

Thanks
JEPEDEWE
 
Posts: 9
Joined: Mon Apr 25, 2011 8:15 am

Move words around, swap words in file name

Postby Stefan » Thu Oct 25, 2012 7:11 pm

An RegEx only works correct for the pattern of file names it was indented for!

FROM:
Anja de Crom - Villa Volta.epub

TO:
de Crom, Anja - Villa Volta.epub


DO:
RegEx(1)
Match: (.+) (.+) (.+)( -.+)
Repla: \2 \3, \1\4


Explanation of this very simple expression:
. ==> match one-occurrence-of-any-sign
+ ==> match one-or-more of the expression right before (one-any-sign in our case)
(...) ==> put the expression into (...) to store what is matched as backreferences (can be accessed by \1 for the first group, \2 for second,...)

So i match three times one-or-more-of-any-sign, separated by an space, and then an space-dash-space followed by one-or-more-of-any-sign

In the replacement i just rearrange that was is matched by the RegEx and stored in the (...)-groups. Adding an comma myself.

Again: this RegEx is only valid for file names like:
Word Space Word Space Word Space Dash Space one-or-more-of-any-sign
like
Anja de Crom - Villa Volta.epub
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: how to???

Postby JEPEDEWE » Thu Oct 25, 2012 7:39 pm

it doesn't seem to be correct...
I get
m, Anja de Cro -
sorry
JEPEDEWE
 
Posts: 9
Joined: Mon Apr 25, 2011 8:15 am

Re: how to???

Postby Stefan » Thu Oct 25, 2012 7:56 pm

JEPEDEWE wrote:it doesn't seem to be correct...
I get
m, Anja de Cro -
sorry


Then you didn't have typed the regex correctly.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: how to???

Postby JEPEDEWE » Sat Oct 27, 2012 7:43 am

OK, it works.. thnaks
Now I wanted to change what you suggested so it would work with names like
Allan Folsom - Dag Van Bekentenis.epub
and rename into
Folsom, Allan - Dag Van Bekentenis.epub
but I can't find the right combination

Thanks again
JEPEDEWE
 
Posts: 9
Joined: Mon Apr 25, 2011 8:15 am

Swap first two word around, add comma, change order

Postby Stefan » Sat Oct 27, 2012 8:52 am

Same as above. Only difference is, there are only two words now.

FROM:
Allan Folsom - Dag Van Bekentenis.epub
TO:
Folsom, Allan - Dag Van Bekentenis.epub

DO:
RegEx(1)
Match: "(.+) (.+)( - .+)"
Repla: "\2, \1\3"

Note: the " " quotes are only for clarify, don't write them too.




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

Re: how to???

Postby JEPEDEWE » Sat Oct 27, 2012 10:52 pm

I would like to see
Waanzin - Anne Allee.epub
as
Anne Alle - Waanzin.epub

So I wrote:
RegEx(1)
Match: (+.-) ( - .+)
Repla: \2,\1

Nothing happens.... Just when I thought I understood the system.... :wink: :?
JEPEDEWE
 
Posts: 9
Joined: Mon Apr 25, 2011 8:15 am

Re: how to???

Postby Stefan » Sat Oct 27, 2012 11:37 pm

You have only one dash in your filename, so you can match it only one time too.

Read an RegEx tutorial first so you will understood what all this meta chars means.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: how to???

Postby JEPEDEWE » Sun Oct 28, 2012 10:29 am

I took a look at "perlrecharclass" but found it too complicated for my level of computing
this is what I tried
(+.-)(.+)
\2\1
but... nog good..
I must have all characters before "-" and all characters after "-" and then swap them..

Thanks for your kind help
JP
JEPEDEWE
 
Posts: 9
Joined: Mon Apr 25, 2011 8:15 am

Swap exchange parts of filename at dash minus sign

Postby Stefan » Sun Oct 28, 2012 12:19 pm

JEPEDEWE wrote:I must have all characters before "-" and all characters after "-" and then swap them..


You can find this request and the solution several times in this forum,...
particular if the questioner have used an better subject then always "how to???":

(.+) - (.+)
\2 - \1



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


Return to BRU Support