Replace Family name and First name

Advanced Renamer forum
#1 : 22/06-13 17:15
Rien
Rien
Posts: 4
I have een E-book file of about 7000 items.
The standard method for a filename for E-books is: Booktitle - Author first name Author familyname
My problem is that about 25% (so about 1750 items!!) do have as filename: booktitle - Author familyname, Firstname

I have checked all possibilities in this WONDERFULL program but I could not find a solution to make the change in a batchmethod.

Can someone help me??
Regards


22/06-13 17:15
#2 : 23/06-13 10:59
Kim Jensen
Kim Jensen
Administrator
Posts: 756
Reply to #1:
Try to add the replace method and configure it like this:
Text to bereplaced: - (.*), (.*)$
Replace with: - \2, \1
Use regular expression: Checked
Apply to: Name

I think this will work. Normally I try the solution out, but am not able to do that right now. If it does not work, I will find another solution for you.


23/06-13 10:59
#3 : 23/06-13 17:59
NomenEtOmen
NomenEtOmen
Posts: 29
Reply to #1:
i had an similar problem and i've solved it with a advancedRenamer-Script.

my ebooks are organized in hierarchical folder structure with

familyname, firstname

or, if more than 1 author:
familyname, firstname & familyname, firstname

or, it is an scientific publication
author - title [publisher, year]

to reorganize this top folder level i use the attached script. for your purpose, you have to adapt the syntax for your needs.


attachment:

/**
list of words: first word to last, separated with ''
word words -> words word
**/
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


23/06-13 17:59