How to bulk rename TXT files?

I’ve received a bunch of files (some hundreds) with the exact same filename (please don’0t ask me how and why, but they did it…).

Now I want to rename these files following this pattern: from “filename” to “filename 0001”, “filename 0002”, etc…

I’ve checked the scripts under the Rename folder, and I see I can bulk replace parts of the filename with other text.
But how about the order number?
Is it possible inside DT? How?

If the documents are in DEVONthink, you can select them all and use Tools > Batch Process and use the Counter placeholder before or after the name.

The counter will go from one to the number of selected items. So if you want them all uniquely numbered, select them all, not just a batch of them.


I’ve checked almost everything but the Batch Processing. I totally missed it. Thank you very much!

Now I have another (batch) question:
How do I batch replace a long string of text with another one?

It’s at the very beginning of the text file.
I’ve tried with the script in the Edit section, but I’m only able to replace this text line by line, not the whole block of text.

I need to replace this text with…nothing…I simply have to delete it from these hundreds of files.

Well…I also have some text to remove from the very bottom of the file… :wink:

You can’t modify the content in that way without scripting and in this case you need something very custom.

As @bluefrog said: A script, perhaps using a regular expression. Is it the same text for all these files? ARE YOUR SURE OF THAT?

Forgive my screaming, but a replace by nothing with a script is not something that you can un-do. The text is gone for good afterward. And does it only occur once at the beginning of the file, or might it be found at other places, too?

Nice question.
I’ve checked and yes, it’s the exact same.
They are the text of the menu of a website (the files are all HTML files from the same website, converted to TXT), so it’s the same at the same position for ALL the files.

The same as the bottom string of text, that is the footer.

No need to ask for forgiveness, I thank you for your questions.
Yes the whole block of text occurs only once per each file.