I have , by cannibalising existing scripts from within DT ( thanks to the authors), and adding in bits found here in the DT user group put together a script that , I hope, will backup all open databases, and then when that process has finished move the resulting zip files to my iCloud Drive.
It successfully achieves the backup of all open databases, but I cannot get it to move the resulting files, I get the following error message
error “Can’t get every file of “:///Users/christopher_harris/Backup”.” number -1728 from every file of “:///Users/christopher_harris/Backup”
This is the script
-- Daily backup archive.
-- Created by Christian Grunenberg on Mon Jun 22 2009.
-- Copyright (c) 2009-2019. All rights reserved.
(* modified CJH*)
tell application id "DNtp"
set allDatabases to every database
repeat with thisDatabase in allDatabases
try
if not (exists thisDatabase) then error "No database is open."
set this_database to thisDatabase
set this_date to do shell script "date +%y-%m-%d"
set this_path to path of this_database
set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "/"}
set this_name to the last text item of this_path
set AppleScript's text item delimiters to ""
if this_name ends with ".dtBase2" then set this_name to (characters 1 thru -9 of this_name) as string
set this_archive to "~/Backup/" & this_name & " " & this_date & ".dtBase2.zip"
set AppleScript's text item delimiters to od
show progress indicator "Daily Backup Archive" steps 3
with timeout of 1200 seconds
step progress indicator "Verifying..."
if (verify database this_database) is not 0 then error "Database is damaged."
step progress indicator "Optimizing..."
if not (optimize database this_database) then error "Optimization of database failed."
step progress indicator "Zipping..."
if not (compress database this_database to this_archive) then error "Backup failed."
end timeout
hide progress indicator
on error error_message number error_number
hide progress indicator
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end repeat
set sourceFolder to ":///Users/christopher_harris/Backup"
set destinationFolder to ":///Users/christopher_harris/Documents/Computing/Devon%20Think%20Backup"
tell application "Finder"
move every file of sourceFolder to destinationFolder
end tell
Clearly I am doing something wrong in the last part fo the script, but I cannot see what.
Any ideas please?
Thanks