Smart rule to change file name

Ok, @Blanc, that works fine now.
Thank you and @BLUEFROG and @cgrunenberg so much

2 Likes

You’re welcome. :slight_smile:

1 Like

You’re most welcome - thank you for expanding my horizon: I’ve never used RTL (simply trying to use the delete key stumped me for a moment) or the Hebrew alphabet before :slight_smile:

1 Like

Silly question: how do I input the “*” in the “Change Name” action? Any time I use such a rule, the complete name gets completely changed to *.

Thanks

Found it - right click - sorry

No worries!

And for the future readers, it’s Right-click or Control-click > Insert Placeholder and in this specific case, it’s Document String. :slight_smile:

Is there a way to delete a certain string in a name which is neither a prefix nor a suffix?

Am example filename or two would be helpful to assess this.

Sorry for being imprecise. I use the Smart Rule on Emails to remove automatic additions by the server I have to use. Surprisingly (for me, at least), the following works:

That is a prefix. I understood that you were asking about reviving something from the middle of the name (neither prefix nor postfix)?

That’s correct. The rule also removes potential prefixes like “Re:” from the name of the mail. Ideally, those terms would remain. Any ideas how to do this?

Lots of ideas, all revolving around regular expressions. Which means that the name has to be kind of regular in the first place: if you can describe the pattern, I can provide the RE.

, however, is not a sufficiently precise description of a pattern: what are the possible pre-prefixes you want to keep. Or alternatively: what are the strings you want removed?

It’s “[External]”. I appreciate your help

In the „Scan name“ part,
(.*)\[External\](.*)
and in the replace part
\1\2
should do the trick.
However, that only works for names containing [External].
I can’t test right now since I’m away from my desktop.

1 Like

But, to underscore @chrillek’s inquiry… is it always External between the braces?

There are 2-3 more standard words between brackets. I figure I will be able to adjust the expression accordingly. I’ll test chrillek’s proposal once I’m back at the Mac. Thanks anyway.

There must be a bug in that expression. It always changes the name to "\1\2”. Sorry, I am new to regular expressions.

Maybe it is $1$2, those two are the only possibilities. Also, you might have to make sure that the replace part is using regular expression syntax (right click?)

No, it should be \1\2 - well, it was last time I looked; @yfs pls post a screenshot of the rule.

I hadn’t realised DTP had an inbuilt smart rule to “scan name” using regex - nice! :slightly_smiling_face: Thanks, @chrillek!

Inspired by this post I tried something similar to convert file names from “YYYY-MM-DD - Name of document” to “Name of document” and set the creation date to the YYYY-MM-DD string.

It worked a charm.

So FWIF I don’t think @yfs’ problem is with the “replace” expression.

2 Likes