Subject: Re: [Name Mangler Talk] Re: Need help setting up this sequence: model1_01-03, model2_01-03, model3_01-03, etc

From: Rob Griffiths <[email-masked]>
Date: Fri, 2 Dec 2011 10:01:29 -0800

On Dec 2, 2011, at 8:18 AM, Ash Ahmadzadeh wrote:

> Oh and what I'd like to see is "model1_001.jpg, model1_002.jpg,
> model1_003.jpg, model2_001.jpg, model2_002.jpg, model2_003.jpg,
> model3_001.jpg, model3_002.jpg, model3_003.jpg, etc". So
> modelX_00(1-3).jpg, X being a sequence.

You can do this, but it requires advanced mode. This code should work, but please, try it on a copy of your originals!

[concatenate
  [truncate <name>, "5"],
  [sequence from "1" step "1" sleep "2" max "0" digits "1"],
  "_",
  [sequence from "1" step "1" sleep "0" max "3" digits "3"],
  [if
    <extension>
  then
    [concatenate ".", <extension>]
  else
    ""
  ]
]

And to help you understand what this is doing, in case you want to modify it...

[concatenate
  Combine everything that follows

[truncate <name>, "5"],
  Take the first five characters from the original filename.
  In-progress filename: model, model, model, model, model, etc.

[sequence from "1" step "1" sleep "2" max "0" digits "1"],
  Append a one-digit sequence number after the name. The sleep "2" means that it will do the first number, then two more of the same value before incrementing. So we wind up with identical sets of three numbers.
  In-progress filename: model1, model1, model1, model2, model2, etc.

"_",
  Add an underscore.
  In-progress filename: model1_, model1_, model1_, model2_, model2_, etc.

[sequence from "1" step "1" sleep "0" max "3" digits "3"],
  Append a three-digit (digits "3") sequence number after the underscore. The max "3" means that it will repeat the sequence after doing a set of three.
  In-progress filename: model1_001, model1_002, model1_003, model2_001, model2_002, etc.

The rest of it just makes sure that if the filename has an extension it gets reattached to the final filename.

Hope that helps!

-rob.

---

From: Ash Ahmadzadeh <[email-masked]>
Date: Fri, 2 Dec 2011 08:18:22 -0800 (PST)

On Dec 2, 11:15 am, Rob Griffiths <[email-masked]> wrote:
> On Dec 2, 2011, at 7:16 AM, Ash Ahmadzadeh wrote:
>
> > I've taken 783 pictures of 261 products (so 3 pictures of each) and
> > need to rename the files so that they follow the naming convention
> > modelX_01-03, X being a sequence, any ideas how to do this?
>
> Can you send a set (two sets of three, ideally) of examples, showing the exact before-and-after filenames you'd like to see? Without the "before" filenames, it's basically impossible to figure out what renaming we need to do.
>
> thanks;
> -rob.

---

From: Ash Ahmadzadeh <[email-masked]>
Date: Fri, 2 Dec 2011 08:16:37 -0800 (PST)

Hi Rob,

The way I have it now is "model_001.jpg, model_002.jpg, model_003.jpg"
to "model_783.jpg".

---

From: Rob Griffiths <[email-masked]>
Date: Fri, 2 Dec 2011 08:15:19 -0800

thanks;
-rob.

---

From: Ash Ahmadzadeh <[email-masked]>
Date: Fri, 2 Dec 2011 07:16:59 -0800 (PST)

Hello all,

Thanks.