Database Export - better default name with hour-min

The export to Database is great, but the default name only has the date. If you do multiple exports a day, or more than one, you clobber the same file over and makes it hard to recover in case of emergency. Any chance you could just add the hour and min stamps, ex from KSTran 2020-02-28.dtBase2.zip to KSTran 2020-02-28-09-28.dtBase2.zip . Most file systems handle longer file names, anyway.

Considering the entire database is zipped, why are you doing multiple exports per day?
A proper primary backup would be a better option.

I like incremental backups of the whole system, same thing I do when archiving source code (common practice in the SW industry), and disk space is cheap. I rather have multiple backups of important data rather than a big one updated once a week or so.

Even better would be for DT3 to do behind-the-back backups when idling…

Also, I assume you don’t modify data (like removing anything) when doing zip based archives.

OK, what about this which is the common UI way with word processors and other editing tools with Mac applications, if you override a file with the same name, scan the folder for file names and if the same, append a number that increments in case such a number is already used, ex:
mydocument.foo, mydocument-1.foo, mydocument-2.foo.

If I remember Apeture/iPhoto source code, been a while, we actually had a flexible way to define a template for the file or export file names so the end users could puzzle together just any kind of combination, but that might be overkill for DT3. Just avoiding clobbering existing files for exports would be a start.

The script is editable, so you could easily modify the output’s filename if you’d like.

Oh good, will fix that then on my end. It would still be good to avoid clobbering files in general.

I changed the AppleScript to:
set this_date to do shell script “date +%y-%m-%d-%H-%M”

However DevonThink is still picking up the previous version, also after restart. Is it cached somewhere, how to force the new version to the Export… menu? The scripts runs from the Script menu itself but it does not prompt for location and it’s easy to get the location pointing at the wrong place if export is used for various export formats.

Oh there are two versions of all the scripts, and the menu one is using the one from the bundle:
/Applications/DEVONthink 3.app/Contents/Resources/Application Scripts/Menu/Export

Interesting… I assumed it was synchronized to use the same script. Assume the bundle one also takes care of opening the dialog box which is missing from the other version.

The scripts are actually stored in ~/Library/Application Scripts/com.devon-technologies.think3, the ones of the bundle should never be modified.

1 Like

@cgrunenberg is correct. You should never mess about in the internals of the application.

Script menu > Open Scripts Folder is where you should have gone.

Yes I know but I want the export menu to have a better qualified name, and the ~/Library/Application Scripts/com.devon-technologies.think3 is only available from the Scripts menu, I should fix that one to prompt for a folder, that should do it, too.

What you’re doing is unsupported and could easily break or be replaced in updates. I would suggest just sticking to the script menu script.