My question was closed as exact duplicate 11 days ago:
batch-rename filenames with numbers to sort alphabetically

For some reason i did not receive any notification about this, so I noticed it just now.

The referenced duplicate question is:
How can I mass rename files from the command line or using a 3rd party tool?

While both questions deal with mass-renaming, i do not understand how the previous question is identical to mine, and none of the answers to the previous question seem to answer my question.

My question:

In a set of files with the same prefix text followed by a number, I want to pad each number with as many zeroes as the highest number has digits.

previous question (highlighting by me):

I've got a bunch of files named with a the pattern 99 - DescriptiveName.txt and I'd like to remove the number from the front so I just have DescriptiveName.txt.

Removing a number and padding the number with the appropriate amount of zeroes are certainly related problems, but still fairly different. Simply removing all digits is much easier than finding the largest number for each related set and padding the other numbers. And none of the tools suggested in the first question (Bulk Rename Utility, AntRenamer, Free Commander Portable etc.) seem to be capable of solving my padding problem.

Perhaps there is no tool capable of this, and I need to write a script, as the only comment to my question before the locking suggests. If so that would of course be an acceptable answer.
Or perhaps my question was poorly worded, then I would like to get some feedback about that and revise it until the meaning is apparent.
But I always try my best to find whether a question has been answered in the past, before asking it, so I am a bit miffed that it was marked as a duplicate.

  • This is an easy thing to solve with php or perl - do we assume that you are running windows and can install them? Commented Jul 25, 2011 at 2:26
  • Yes, I have activePerl installed. Perhaps I should have tried writing a python script instead of asking the question. My thinking was that surely this must be a common problem, so no need to reinvent the wheel. But i would also be interested in learning why the question was closed, and what I can do to avoid it in the future
    – HugoRune
    Commented Jul 25, 2011 at 2:32
  • OK, I'm writing a solution for you now... Commented Jul 25, 2011 at 2:34
  • 4
    Guys, discussion of the actual question belong on the question, not in this meta post!
    – nhinkle
    Commented Jul 25, 2011 at 3:27

1 Answer 1


I closed the question after a member of the community flagged it as a duplicate. Given your explanation of the differences, I have reopened the question since it seems evident that it is a slightly different situation.

I would recommend that you edit your question to note that you've read the related thread, and explain which solutions from the other post you tried and how they didn't work. This will make it more likely that you'll get a suitable answer, since people will know what you've already tried.

As a side note, the question was not locked, only closed. A closed question cannot be answered, but can still be commented on, voted upon, and edited. A locked question cannot be changed in any way at all, and this is only done in extreme problematic cases, which yours of course is not.

Thanks for bringing this up for discussion! Good luck with your problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .