insert creation date in the name of a file

I found the script Rename to creation date really useful. But what I would like to do is to insert the creation date in the beginning of the name. I opened the script but it’s beyond my ability.

Someone can help?



In the Rename folder, there should be a Prefix with creation date script. Is that what you need?

Such a script doesn’t ship with DEVONthink Pro (Office) and isn’t available in the Support Assistant either :open_mouth:

Apologies - the script I cited was a personal revision to this script "Rename to creation date”. :blush:

Prefix with creation date would be perfect. Can you share your script?

Here you go. (Note: I’m actually going to completely rewrite it at some point but it should work).
Prefix with creation (4.31 KB)

1 Like

Thanks a lot!

No problem. :smiley:

I don’t see the “Rename to creation date” script. Is this no longer present in DEVONthink 3? I am looking for a script to rename files to date/time: YYYYMMDDHHMM

I attempted to modify ‘Prefix with creation’ linked above, but was not sure how to get at time (HHMM).

By the way - both batch processing and smart rules can perform renaming too (although in this case additional placeholders for hour and minute would be necessary as the time placeholder uses HH:MM).

But beta 3 will include the necessary placeholders :slight_smile:


Thanks for the reply! Batch Process... with placeholders gets me very close. Just need placeholders for Creation Hour and Creation Minute.

What’s the grammar to, e.g. add specific parts of the creation date to the record’s name?
The otherwise readworthy documentation leaves out the fineprint here.

Control-click > Insert Placeholder > …

Leading to a Batch Process of as an example…

I will think about ways to make this more clear.

1 Like

Very nice, thank you. Looks great.

You’re welcome. Cheers!

Hi all,

Is there any way to do the following:

  1. limit the year placeholder to 2 characters? So instead of 2019 -> 19
  2. how can I access the second that a file was created? I’ve tried %recordCreationSecond% but that doesn’t seem to work

I’d like to batch rename files in the following format yyMMddHHMMss without any delimiters.

Thanks in advance!

Welcome @sunnySloth

Neither of these options are possible via placeholders, only scripting.
Note: Many date renaming scripts have been posted on the forums over the years.

Here is one approach with a teaching edition AppleScript example…

tell application id "DNtp"
	repeat with thisRecord in (selection as list)
		set recordName to (name of thisRecord)
		set creationDate to (creation date of thisRecord)
		set thisYear to year of creationDate as string
		set thisMonth to month of creationDate as integer -- As string produces the name of the month.
		set thisDay to day of creationDate as string
		set thisHour to hours of creationDate
		set thisMinute to minutes of creationDate
		set thisSecond to seconds of creationDate
		set thisYear to (characters 3 thru 4 of thisYear) as string
		set titleDateString to (thisYear & thisMonth & thisDay & thisHour & thisMinute & thisSecond & "_")
		set name of thisRecord to titleDateString & recordName
	end repeat
end tell

From Script Editor, save this script in ~/Library/Application Scripts/com.devon-technologies.think3/Menus and you can use it on selected files from DEVONthink’s Script menu.

Hi Bluefrog! Thanks a mil for your help and the above script! It’s a huge help!

1 Like

You’re welcome :slight_smile: