Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Help with changing name order from....

Help
Will Garth
2008-09-22
2013-04-26
  • Will Garth
    Will Garth
    2008-09-22

    Help with changing name order from "<name> <last name>" to "<last name>, <name>"

    I have lots of folder that are named like <name> <last name> and i need to change them to <Last Name>, <Name>.

    For example <andrew blake> to <Blake, Andrew>

    help would be much appreciated. 

     
    • onomou
      onomou
      2008-09-23

      I think one of the best ways to do this is with regular expressions. I'm not super versed in the syntax, but I can achieve your desired effect by using several functions like so:

      Use two Insert functions to insert a space a a prefix and a comma as a suffix.
      Use a Move Text function to match ^(\s\w+\s) as a regular expression, which matches at the beginning a space followed by word characters followed by another space. Move the match to position -1 to put it at the end.
      Use a Replace function to match $\s as a regular expression, which matches a space at the end, and replace it with nothing to delete it.

      That should work as long as you don't have first or last names with more than one name in each (Georg Friedrich Handel wouldn't work without some modification to the process). I haven't found an easy way to do this like in Mp3tag where I could match ^(.+)\s(.+) and replace it with $2, $1 (you can find a lot of useful regex functions on the forum of mp3tag.de).

      Anyway, hope that helps. More info on regular expressions can be found at http://www.regular-expressions.info/quickstart.html