Document name renaming

I have recently made the move from a manual, finder based filing system to DT Pro Office. In the old manual system, I began each file name, some 10,000+ in number, with a six digit naming prefix that listed out year, month and date. For example:

130315 = March 15, 2015

120101 = January 01, 2012

011231 = December 31, 2001,

and so on.

While relevant to my manual based system at the time, as you’ve guess by not, this numbering system is no longer relevant. In fact, I find it quite annoying when I’m using DT. So…

How can I strip the XXXXXX numbering in front of 10K DT document titles automatically?

The “Rename using Regex” script that can be installed from Help > Support Assistant can be used to strip off your prefixes. I suggest trying this experimentally first, in a test database, and then when you are satisfied the process will work start with the actual data. Renaming 10,000 records at one time should work, but is it really necessary to submit your data to an all-or-nothing approach? I suggest breaking the work into chunks and validating results before going on to the next chunk.

For the sample you posted, this Regex should find the leading digits followed by one space, at the beginning of the file name


Thanks for your timely and informative reply Korm.

I found the REname using Regex script and got it loaded into DT.

I selected a couple of documents > initiated the script > pasted in ^[0-9]*\s to the “enter source pattern” box > clicked Accept > tried both adding nothing and a space into the resulting "enter destination pattern, but nothing happened.

What am I missing?

Your batch approach is quite wise advise. Am I correct in thinking that if I select a small number of docs prior to running the script, I’ll achieve the small batch at a time result?

Nothing? :slight_smile:

Like you, I couldn’t get the Rename using RegEx script to accept an empty destination pattern. A simple fix, without considering side effects (as someone who, unlike me, understands AppleScript could do), is removing this test:

and destPattern is not ""

from this line:

if sourcePattern is not "" and destPattern is not "" then

Speaking of scripts…

What’s the reason the names displayed under menus sometimes differ from their filenames? For example, the filename for To Web Page Title in the menu is _Set Name To Title Of Web Page. I don’t see anything obvious in filenames or script content that’s causing menu text to differ as it does.

It is set in the localization parameters for your language, in the Scripts.strings file. For example, English:

"Set Name To Title Of Web Page" = "To Web Page Title";

or, French

"Set Name To Title Of Web Page" = "Vers le titre de page web...";

(BTW, interesting that the French localization has unnecessary elipses, such as you’ve pointed out elsewhere in DEVONthink.)

@kadso: What’s your filename look like? 123456-My file.txt ?

Thank you! Now I see, said the previously blind man.

I’ve looked at localization files but it never occurred to me they could apply to scripts, which kept me from exploring inside the app bundle.

Jim: The current script not honoring an empty destination pattern seems to be causing kadso’s problem. It can’t be used for prefix/suffix removal without a change like I posted.

Yep, I see the fix, sjk (and I don’t see any immediate ill effect of a null value other than wasting some CPU cycles 8) ). I was just buzzing around in Terminal when I saw this post and I was just wondering about the constancy of the filename.

Isn’t it the name(s) of the selected Dt record(s) that matters, not any corresponding filename(s)?