Using 'Scan Name: Date' action

I am getting started with Smart Rules and I had a question about extracting dates as part of the ‘Scan Name: Date’ action.

I am trying to set up a smart rule that takes a document with a file name like this:

Savings Statement - July 2023

And renames it to this:

2023-07 Savings Statement

So, I am hoping to scan the month and year in the first filename and then use placeholders to use those values in the rename action.

(Note in the action below, I use Display Alert instead of Rename for testing.)

The result that is displayed is:
2025-01-Savings Statement - July 2023

I have a few questions. (Note the questions are both to accomplish this particular task but also to learn about how this action works in general.)

Does “Scan Name: Date” require a full date value (day, month, and year)?

What is the text field in the “Scan Name: Date” action for (with the placeholder text ‘Prefix*Suffix’)?

Should I be able to use date placeholders in that text field to let the scan action know what it is trying to parse?

Is it possible to do what I am trying to do with a smart rule without calling out to a script as one of the actions? If so, how?

The handbook says:

(I don’t know what (BP) stands for, though)

A short test with a file containing a complete date in its name (and * as placeholder in the scan name action) seems to work ok. So, one of the issues is the incomplete date in the file name, I suppose.

Thank you, yes I had read the documentation. These are the questions that I had after reading the documentation.

Using a ‘Scan Text: Regex’ can capture the year at the end and move it to the front of the name easily enough.

In this case, is there some way to capture the month name and convert it into a two-digit month for the file name?

I suppose I could also do a rename prepending “1 ,” to the year at the end of the name giving the date scanner a full date to scan, but it seems like there should be a more straightforward way.

Batch Processing

1 Like

Does “Scan Name: Date” require a full date value (day, month, and year)?

Yes.

What is the text field in the “Scan Name: Date” action for (with the placeholder text ‘Prefix*Suffix’)?

The delimiter and the wildcard denotes the captured value. Savings Statement - July 1 2023- * = July 1 2023.

Should I be able to use date placeholders in that text field to let the scan action know what it is trying to parse?

No. Placeholders are used in the output, not the filtering criteria.

Is it possible to do what I am trying to do with a smart rule without calling out to a script as one of the actions? If so, how?

With a valid date, yes.
Per your example, including a day…

… yielding…

Note the second Scan Text is due to your - in the original name. Without the postscan for it, you’d end up with a name of 07-2023 Savings Statement -.

1 Like

Thank you - I have the action working now.

You’re welcome!
Are you following the logic behind the actions? I would guess so, but I prefer not assuming :slightly_smiling_face:

Yes, I think I am. It is useful to be able to scan and rename multiple times in the same smart rule.

Since the name of the downloaded file only includes the month and year, I was able to do a regex scan, rename by inserting a day value to create a complete date and then use the date scan to extract the month name value and use the placeholder to use it as two digits in the final rename of the file.

A very clever approach :smiley:

And though @jamesdempsey didn’t share his specific approach, here is an illustration of a regular expression pattern matching in this naming convention. Note the ([A-Za-z]{3,8}) matches between 3 and 8 upper and lowercase letters, so May to December.

And the Change Name action inserting 1 between the month and year’s capture groups…

3 Likes