I have been trying to change the name of a file with automatic rules and want to add the date. However I do not wish to add YYYY but YY, so I want to write 210321 instead of 20210321. Can anyone help me here? Thank you very much!
I looked but couldnât find any way to change YYYY to YY with operators.
I am using the document date which I first let DEVONthink extract and in case it is necessary I correct it (several automation steps)
I still donât actually know what youâre doing - but assuming you have got a created/modified/document date then a smart rule can add that date in short form (that is DD.MM.YY) to the name using a placeholder.
Placeholders are accessed from the context menu of the change name field.
If that is not what you are looking for, could you please explain in rather more detail what it is you are doing and how you are getting there (i.e. screen shots of rules, scripts etc.) - that would make helping you easier
thanks for getting back to me. I did find the smart rules and in that way I did enter the year (in yyyy, 2021), the month (in mm, 03) and the day (in dd, 22). There is an option to enter the document date in yyyy-mm-dd (2021-03-22). However, my inner monk wants to have yymmdd (210322) in the file names.
Nooooo, really, there is an option there for DDMMYY, really itâs the one I posted above. I donât know what the German equivalent is @MichaelHD, @SteffisCloud weiĂ das einer von euch?)
You can use an Execute Script action in a smart rule to modify the date order, if this is something youâd need done regularlyâŚ
on performSmartRule(theFiles)
tell application id "DNtp"
repeat with thisFile in theFiles
set docDate to (document date of thisFile)
set theYear to my zeropad((characters -2 thru -1 of (year of docDate as string) as string) as integer)
set theMonth to my zeropad(month of docDate as integer)
set theDay to my zeropad(day of docDate)
end repeat
set name of thisFile to (theYear & theMonth & theDay & "_" as string) & (name of thisFile)
end tell
end performSmartRule
on zeropad(num)
if num < 10 then
set num to "0" & num
end if
return num
end zeropad
One more question: I just noticed that the placeholder uses the document date which is not always the correct vlaue. I have set a date as custom value which I use to have the correct date. Itâs just called âDatumâ (German for date) and formatted as date. I wonder: Could you modify your script above so that I can use this custom date value?
Or is it possible to change document date somehow? I canât find that option anywhere.
Thanks, I thought about this as well. Iâm not sure if using a meta data text field is the best idea:
I use the date for sorting and plan to use it in other scripts. Would a custom meta field text allow this? Sorting would probably work, but using the date in other Skripts? In addition I use intelligent rules to set the date based on document date - in about 70% to 80% of cases the document date is correct.
Furthermore I already have a ton of documents dated with this logic so I would have to change all of the existing ones.
Easiest would probably be if I could change the document date - if this is possible.
Thanks. I start feeling guilty, but I have to ask: How can I change the document date? I can see creation and modification date but not document date. I might have to calm my inner monk, but I believe I can live with yyyy-mm-dd which is possible to use. THANKS a lot!
The document date is a property filled by DT automatically based on the first date extracted from the text of a document. So whilst you canât (to the best of my knowledge; this property is marked âread onlyâ in the script dictionary) change the document date, you donât actually have to use that date to change the name of your file. You could just as easily use the creation date, which you can change.
I set the creation date of all my files to the actual document date (using a simple rule to equate the creation date to the document date in some cases, but more complex scripts to extract the correct document date and equate the creation date to it in other cases). The addition date remains put, so I can still see when I actually added the file to DT.