#1 : 02/10-13 23:46 Bernie2504
Posts: 17
|
Hallo
i have a problem to swap a "2 words Folder Name" e.g. a folder name like this : Bob Marley i want to swap it to : Marley, Bob i use the "replace method" with : Text to be replaced: <word:1> <word:2> (Bob Marley) Replace with: <word:2>, <word:1> (Marley, Bob) (that's what i want) but the created new folder name is : ,Bob Marley what's wrong in this method and what would be the correct method ? please help Bernd (Germany) ---------- Bernie2504 |
#2 : 04/10-13 15:53 Stefan
Posts: 262
|
Reply to #1:
That looks like a great syntax to use, but it doesn't works that way. You can use this regex for two part names: FROM: Bob Marley Bob Marley And The Wailers TO: Marley, Bob Wailers, Bob Marley And The USE Replace method and "Match everything till last space and then the rest": Replace: (.+) (.+) With: \2, \1 [X] RegEx - - - Me thinks New Name: <Word:2> <Word:1> should work too. But for me (3.56) this only works with files, not with folders. ---------- If this tool had saved you time, perhaps you want to donate an Dollar to Kim? See http://www.advancedrenamer.com/download >>> [Donate] button. |
#3 : 04/10-13 17:33 NomenEtOmen
Posts: 29
|
Reply to #1:
i have solved this problem with a rename-script. the advantage using a script instead of a regex-pattern: you can extend it with logic behaviour. so i have extended my script to - no renaming, if the separation character (set to ",") is already in the dir-name - renaming word word... lastWord to lastWord, words... (if you there is more than one surname - inteligent renaming by two or more names concatened with &: sname1 fname1 & sname2 fname2 -> fname, sname1 & fname, sname2 installation: new method -> script : copy in the attached script code mfg NomenEtOmen Attachment: the script: /** list of words: last word to front position, separated with a separation char (sSep) word(s) word -> word, word(s) **/ var oName = item.name ; //original name var nName = "1" ; //new name var last = "" ; //ast word var aHelp ; var sSep = "," ; //the separator after first word var nChg = 0 ; //anything changed? var bSeparatorDetection = 1; //contains , if (bSeparatorDetection && oName.indexOf(sSep)>=0){ return; //de-activate renaming for . } var bConnectorDetection = 1; //contains no ' - ' if (bConnectorDetection && oName.indexOf(" - ")>=0){ return; //de-activate renaming for . } //contains no [] if (bConnectorDetection && oName.indexOf("[")>=0 && oName.indexOf("]")>=0){ return; //de-activate renaming for . } /* split-variante */ var comp = oName.split(" & "); if (comp.length<1) { //no spliting comp.push(oName); } for (var i = 0; i < comp.length; i++) { aHelp = comp.split(" "); if (aHelp.length<=1) { //no spliting } else { //it has splitted :-) nChg = nChg + 1; last = aHelp.pop() + sSep; aHelp.unshift(last); comp = aHelp.join(" "); } } if (nChg<1) { return; } else { //script-end: new name nName = comp.join(" & "); return nName; } ---------- neo |
#4 : 04/10-13 19:53 Bernie2504
Posts: 17
|
Reply to #3:
Dear NomenEtOmen Manny thanks for the script i copy it and start it via "new method:script" i have tested it, but i get an error message : line 0: itemFunc is not defined something what i have forgot to do ? Best regards Bernd ---------- Bernie2504 |
#5 : 04/10-13 20:06 Bernie2504
Posts: 17
|
Reply to #2:
Dear Stefan manny thanks for the help your tip works great the "advanced renamer Syntax" is not so familiar to me (sometimes) best regards Bernd ---------- Bernie2504 |