Page 1 of 1

Batch rename with values from columns

Posted: 05 Sep 2022 09:38
by n00bs
Hi everyone

I've played around with scripting and renaming as well as browsing this forum and still can't quite figure out how you would batch rename with values taken from columns.

For example, let's say I have jpgs of dogs and the image files all have random names. Now I would like to give them all a name with information taken from columns, consisting of the value entered in the column "age", "color", "breed", and "gender". In the end, the names should look something like this "09_brown_GermanShepherd_f.jpg".

I'm sure that XYplorer could handle such an easy thing and I'm just too noob to figure it out. Does anyone have a tip on how to approach this task?

Re: Batch rename with values from columns

Posted: 05 Sep 2022 09:53
by highend
Would you mind telling us which columns you've actually used? Extra1, Extra2, Extra<x>?

Code: Select all

    $age     = tagitems("ex1");
    $color   = tagitems("ex2");
    $breed   = tagitems("ex3");
    $gender  = tagitems("ex4");
    $newName = trim($age . "_" . $color . "_" . $breed . "_" . $gender, "_");
    if ($newName) { renameitem($newName); }

Re: Batch rename with values from columns

Posted: 05 Sep 2022 10:44
by n00bs
yes. of course! It's extra5, extra6 and extra7

Re: Batch rename with values from columns

Posted: 05 Sep 2022 10:46
by highend
Then replace the ex1, ex2, etc. with your values and you're done

Re: Batch rename with values from columns

Posted: 05 Sep 2022 10:52
by n00bs
works like a charm, thank you very much!