I’d like to store a version of my database in my Dropbox folder (the getdropbox.com type of Dropbox, that is). That way, I would have rudimentary read-only access to it via the web in a pinch.
The “Files/Folders” option in the Export menu does more or less what I want, but I’d rather have it be a bit more automated. So, I modified the Daily Backup script to create this:
set dropbox_path to "~/Dropbox/Devonthink/"
do shell script "rm -rf " & dropbox_path
tell application "DEVONthink Pro"
activate
try
set this_database to current database
set these_records to the records of this_database
set export_path to dropbox_path
repeat with this_record in these_records
export record this_record to export_path
end repeat
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
end try
end tell
That works fine. In addition to all of the records that I want, however, it also copies the DEVONtech_storage files to the Dropbox. Is there a way I can omit those files from being exported?
I was just fiddling with my own export situation where I didn’t want the DEVONtech_storage, too, and while I didn’t find it-- for your situation a simple scratch area before moving it into your dropbox may be enough?
set dropbox_path to "~/Dropbox/Devonthink/"
set scratch_path to "~/.scratch"
do shell script "rm -rf " & dropbox_path
tell application "DEVONthink Pro"
activate
try
set this_database to current database
set these_records to the records of this_database
set export_path to dropbox_path
repeat with this_record in these_records
set exported_file to export record this_record to scratch_path
tell application "Finder"
move file exported_file to POSIX file dropbox_path as alias
end tell
end repeat
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
end try
end tell
The _storage file will be left behind in the scratch directory (which you can clear out at the end, if you’d like)
Thanks for the help. Unfortunately, that didn’t seem to work. I ended up having the script just go and delete all the files afterwords, which gets the job done. Here’s the code, if anyone’s interested:
set dropbox_path to "~/Dropbox/Devonthink/"
do shell script "rm -rf " & dropbox_path
tell application "DEVONthink Pro"
activate
try
set this_database to current database
set these_records to the records of this_database
set export_path to dropbox_path
repeat with this_record in these_records
export record this_record to export_path
end repeat
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
end try
end tell
do shell script "find ~/Dropbox/Devonthink/ -name DEVONtech_storage -delete"