Rename of files with workflows

What do I need?
An Automator workflow to pick the creation date of the file and to add a prefix to the files name in the following order yyyy-mm-dd.
There is an action in Automator that does exactly what I want, but only on Finder level. I want to handover files in Devonthink via the script menu to be renamed as described above, but still no success. I guess, there must be a handover of the files to the Automator rename action. Any suggestions?

Perhaps the scripts posted in this thread might be useful?

Thanks that was helpful, but I am not very capable in terms of Apple Script. I am able to get it run, but I am unable to customize it to my needs. I need two simple scripts ( yyyymmdd and yyyy-mm) and it may sound simple for an expert, but not for me.

Is there nobody who can help me? Seems to be a heavy topic!

Take the first script from that other thread and change the 14th line. Remove & timestring from the very end of the line. Then save the script in the DEVONthink application scripts folder as “prepend yyyy-mm-dd.scpt”.

Then change the same line and remove & “-” & my zeroPad(day of theDate, 2) from the end of the line and save it again as “prepend yyyy-mm.scpt”

Then select some files in DT and run one of the scripts from the scripts menu.

Bingo! It works. Great! Thanks a lot, you saved me a lot of time.
That was very, very helpful.
Now I got a taste for it.
What do I have to change or to add to get only the last two digits of the year:

  • yymmdd
  • e.g. for today: 110212
    I promise, that will be my last request :wink:

But…but…but that won’t be Y2.1K compliant!! :smiley:

Change the same line as before to the following. It sounds like you want the dashes to be gone too.

YYYYMMDD

return (year of theDate as string) & my zeroPad(my monthToNum(theDate), 2) & my zeroPad(day of theDate, 2)

YYMMDD

return text 3 thru 4 of (year of theDate as string) & my zeroPad(my monthToNum(theDate), 2) & my zeroPad(day of theDate, 2)

YYMM

return text 3 thru 4 of (year of theDate as string) & my zeroPad(my monthToNum(theDate), 2)

And if you want to eliminate the surrounding “[” and “]” then change this line near the bottom:

set prefix to "[" & my formatDateString(this_date) & "] "

```to this

set prefix to my formatDateString(this_date) & " "

Again, thanks a lot. You are my hero :wink:
I am happy so far, now I can start renaming á la carte.
Take care, Thomas