Batch Rename: Numbering reset at 000 for each directory

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
TexasDave
Posts: 10
Joined: 13 Mar 2021 11:39

Batch Rename: Numbering reset at 000 for each directory

Post by TexasDave »

I am loving the tool....I have a quick question. I have a typical layout for my photos...

Code: Select all

Photos Folder
   Directory A
      Photo 1
      Photo 2
      ...
      Photo N
   Directory B
      Photo 1
      Photo 2
      ...
      Photo N
   Directory C
      Photo 1
      Photo 2
      ...
      Photo N
I am using the following batch rename: <folder>_<#000>

Right now, the number continues into the next folder. So if there is 10 files in Directory A the numbering starts at 11 for Folder B.

If I do each folder one at a time, all is well. But I want to highlight multiple folders and have the numbering reset for each folder.

How would I do this? Thanks!

TexasDave
Posts: 10
Joined: 13 Mar 2021 11:39

Re: Batch Rename: Numbering reset at 000 for each directory

Post by TexasDave »

Still hoping to get an idea on how to reset my photo numbering to start from zero for each folder.

I can do one folder at time with the tool but not keen to do that for 500+ folders.

Or I can also write a linux script (they are on a Linux box) but am very rusty. :-)

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Batch Rename: Numbering reset at 000 for each directory

Post by highend »

Write a script for XY instead, like:

Code: Select all

    foreach($folder, <get SelectedItemsPathNames |>, , "e") {
        rename "b", gpc($folder, "file") . "_<#000>", , listfolder($folder, , 1);
    }
One of my scripts helped you out? Please donate via Paypal

TexasDave
Posts: 10
Joined: 13 Mar 2021 11:39

Re: Batch Rename: Numbering reset at 000 for each directory

Post by TexasDave »

Thanks for that - I will explore and give it a go!

Post Reply