Currently, when files are added to a library, the Creation Date of the file is set to the Current Date. I often add items to the library whose filenames have dates older than the current date. In order to synchronize the Filename Date and the Creation Date, I must manually run the EagleFiler “Date from filename” AppleScript each time files are added.
It would be beneficial to have an Esoteric Preference that effects file importation such that it allows the user to chose between Creation date = Current date or Creation date = Filename date. .. Thxs.
To be clear, the Date Created shown in EagleFiler is taken from the file’s own metadata (when the file was actually created). It’s the Date Added that is taken from the current date.
But sometimes, when the file was actually created is not the same as the “logical” date that you want applied to the file. For example, you might have a receipt for a transaction on Thursday, but you scan it into your Mac on Friday, and so the creation date on the file is “wrong” by a day. Is that the type of situation that you’re in?
Yes, that’s what I’m referring to. Various items scanned on various dates whose creation dates end up as the current date, which does not equal the date of the actual document. So, I manually run the “Date from Filename” script, which corrects the creation date, since I always name files to include the document date, in the proper format, YYYY-MM-DD.
I would like a preference that automates this so that the Creation Date automatically adopts the date written in the file name (Date from Filename) when the file is added to the library. Perhaps most people don’t want this behavior, so an esoteric preference might be appropriate.
Years ago I wrote a script that I can run on the selected scanned/OCR’d PDFs in EagleFiler. For each one it displays the document, tries to guess the date and source by rudimentary parsing of the PDF’s text then generates a filename and title (e.g. “Discover 2026-01” for a credit card bill). If I need to correct or amend the date, it pops up a box in which I can do so in the filename (e.g. renaming it to “Discover 2025-12“ or “Discover 2026-01-31”). It then sets the creation date based on the date in the filename/title; if there’s no day of the month it defaults to the 1st of the month (although in retrospect it would make more sense to default to the last day of the month.)
I still use it every few weeks when filing my papers although it’s far from perfect. Would be great to replace it with something more robust!
I appreciate it. I know you are not my personal custom software developer and the “Date From Filename” script does currently solve this issue. So, whatever you deem appropriate and beneficial to you and your user base at large is fine with me.
If you want something that automates this today, you could make a droplet script that imports files and then applies the Date From Filename stuff. Then if you import by dropping files onto the script app instead of EagleFiler, it will import them and set the date in a single step. For example, something like this:
use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
on open _files
tell application "EagleFiler"
tell library document 1
set _records to import files _files
repeat with _record in _records
set _date to my dateFromString(my dateStringFromFilename(_record's basename))
set _record's creation date to _date
end repeat
end tell
end tell
end open
on dateStringFromFilename(_filename)
set _regex to my (NSRegularExpression's regularExpressionWithPattern:"\\d{4}(-\\d{2}){2}" options:0 |error|:(missing value))
set _nsString to my (NSString's stringWithString:_filename)
set _textCheckingResult to _regex's firstMatchInString:_nsString options:0 range:{0, _nsString's |length|()}
set _dateRange to _textCheckingResult's range()
set _dateString to _nsString's substringWithRange:_dateRange
return _dateString as Unicode text
end dateStringFromFilename
on dateFromString(_string)
set _sampleDate to "2015-03-12"
set _dateCharacters to characters 1 thru (length of _sampleDate) of _string
set AppleScript's text item delimiters to ""
set _dateString to _dateCharacters as string
set AppleScript's text item delimiters to "-"
set {_year, _month, _day} to text items of _dateString
return my makeDate(_year as integer, _month as integer, _day as integer)
end dateFromString
on makeDate(_year, _month, _day)
set _date to current date
set _date's year to _year
set _date's month to _month
set _date's day to _day
set _date's time to 0
return _date
end makeDate