# Rename: add sequental numbering to files, but start with 01 for each group with same name

**URL:** <https://resource.dopus.com/t/rename-add-sequental-numbering-to-files-but-start-with-01-for-each-group-with-same-name/22085>\
**Category:** Help & Support\
**Created:** [March 27, 2016, 12:08pm UTC](https://resource.dopus.com/t/rename-add-sequental-numbering-to-files-but-start-with-01-for-each-group-with-same-name/22085 "2016-03-27T12:08:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![opw62](https://resource.dopus.com/letter_avatar_proxy/v4/letter/o/5e9695/32.png) [@opw62](https://resource.dopus.com/u/opw62)\
**Post date:** [March 27, 2016, 12:08pm UTC](https://resource.dopus.com/t/rename-add-sequental-numbering-to-files-but-start-with-01-for-each-group-with-same-name/22085/1 "2016-03-27T12:08:02Z")

</div>

I have a number of files that start with normal filenames but end up with (a lot) numbers, some underscores and some text.  
The numbers and underscores are stripped (regex)  
So the 'normal filenames' remain.

When sorted, many filenames are identical.

I'd like to add a sequence number to the filenames to make them unique again.

However, for each group of same files the counter should start at 01 again, i.e. no number 01,02,03.... 30,31...etc. but instead  
if there are, for instance, 4 groups, of 6 files, it'll read 01,02...06, next group 01,02..06, etc.

So, add sequental numbering to files, but start with 01 for each group with same name.

Like below.

# = ![](https://resource.dopus.com/uploads/default/original/3X/0/9/09841d6cc0621d8c69433ca7e3ce7e4840471ed6.png)

Any suggestions?

# Thanks

---

<div class="post-metadata">

**Author:** ![opw62](https://resource.dopus.com/letter_avatar_proxy/v4/letter/o/5e9695/32.png) [@opw62](https://resource.dopus.com/u/opw62)\
**Post date:** [March 27, 2016, 12:40pm UTC](https://resource.dopus.com/t/rename-add-sequental-numbering-to-files-but-start-with-01-for-each-group-with-same-name/22085/2 "2016-03-27T12:40:18Z")

</div>

# Later... it is like when in the above 'sequential numbering' is untagged, but then again, obviously one does not have controle over the numbering, i.e. layout.

# ![](https://resource.dopus.com/uploads/default/original/3X/b/9/b9d788dd4844e45abee90800fc0e7375a0f08b58.png)

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [March 27, 2016, 1:21pm UTC](https://resource.dopus.com/t/rename-add-sequental-numbering-to-files-but-start-with-01-for-each-group-with-same-name/22085/3 "2016-03-27T13:21:48Z")

</div>

This should do what you want: [Add a Unique Number while renaming](https://resource.dopus.com/t/add-a-unique-number-while-renaming/3900/1)

---

<div class="post-metadata">

**Author:** ![opw62](https://resource.dopus.com/letter_avatar_proxy/v4/letter/o/5e9695/32.png) [@opw62](https://resource.dopus.com/u/opw62)\
**Post date:** [March 27, 2016, 2:43pm UTC](https://resource.dopus.com/t/rename-add-sequental-numbering-to-files-but-start-with-01-for-each-group-with-same-name/22085/4 "2016-03-27T14:43:15Z")

</div>

Like this?

# = ![](https://resource.dopus.com/uploads/default/original/3X/4/a/4a2fdc3b643fb384afe9d199720e989a1f8fad9e.png)

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [March 27, 2016, 2:45pm UTC](https://resource.dopus.com/t/rename-add-sequental-numbering-to-files-but-start-with-01-for-each-group-with-same-name/22085/5 "2016-03-27T14:45:46Z")

</div>

[NUM] shouldn't be appearing in the list of new names at the bottom, unless you just need to click Refresh Preview.

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [March 27, 2016, 2:47pm UTC](https://resource.dopus.com/t/rename-add-sequental-numbering-to-files-but-start-with-01-for-each-group-with-same-name/22085/6 "2016-03-27T14:47:43Z")

</div>

Looking again, it appears you have edited the script (from the small portion visible in the screenshot), and what I can see is not valid VBScript and would not work.

Why did you edit it, and have you tried with the original?

---

<div class="post-metadata">

**Author:** ![opw62](https://resource.dopus.com/letter_avatar_proxy/v4/letter/o/5e9695/32.png) [@opw62](https://resource.dopus.com/u/opw62)\
**Post date:** [March 27, 2016, 3:12pm UTC](https://resource.dopus.com/t/rename-add-sequental-numbering-to-files-but-start-with-01-for-each-group-with-same-name/22085/7 "2016-03-27T15:12:31Z")

</div>

Sorry, my mistake, I assumed I had to add "NUM" etc. there, but that is - I confess - wrong.  
I reloaded the script.

This is what I got.

# = ![](https://resource.dopus.com/uploads/default/original/2X/9/9e427e24a27ecfc2197e203086ad27ae1f37f5f8.png)

Otherwise, how should I proceed?

# Thanks

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [March 27, 2016, 3:19pm UTC](https://resource.dopus.com/t/rename-add-sequental-numbering-to-files-but-start-with-01-for-each-group-with-same-name/22085/8 "2016-03-27T15:19:20Z")

</div>

That looks right now. The numbers are based on which files currently exist, so the preview will show 001 (unless 001 already exists in the directory), but when the rename actually happens, only the first file in each group will get 001, and the existence of that file will then cause the second file to get 002, and so on.

---

<div class="post-metadata">

**Author:** ![opw62](https://resource.dopus.com/letter_avatar_proxy/v4/letter/o/5e9695/32.png) [@opw62](https://resource.dopus.com/u/opw62)\
**Post date:** [March 28, 2016, 5:03am UTC](https://resource.dopus.com/t/rename-add-sequental-numbering-to-files-but-start-with-01-for-each-group-with-same-name/22085/9 "2016-03-28T05:03:36Z")

</div>

Ah right, it was in the description but with all the trying and so on I forgot.

Wonderful!

Thank you so much, this really helps and saves a lot of work...  
Again, many thanks!

=
