Filed under: Software, Productivity, Tips and tricks
Applescript and Filemaker Server 7
Here's something very unusual we recently noticed about Filemaker Server 7 at my day job. If you use its built in Scheduler to schedule backups, it will only let you send a backup to the same disk that Server resides on (previous version of Filemaker Server did not have this limitation). Since that's also where the databases themselves live, backing up to that drive is kind of silly. With your live files and your backed up files on the same drive, you instantly lose both if that drive dies. See? Silly.So, we cooked up a quick and dirty folder action Applescript solution to force the files onto an external firewire drive. Check out the script after the jump.
property dialog_timeout : 30
on adding folder items to this_folder after receiving added_items
try
tell application "Finder"
get weekday of (get current date) as string
set Today to result
if Today = "Monday" then
move added_items to folder "mon" of disk "BACKUP" replacing yes
else if Today = "Tuesday" then
move added_items to folder "tue" of disk "BACKUP" replacing yes
else if Today = "Wednesday" then
move added_items to folder "wed" of disk "BACKUP" replacing yes
else if Today = "Thursday" then
move added_items to folder "thur" of disk "BACKUP" replacing yes
else if Today = "Friday" then
move added_items to folder "fri" of disk "BACKUP" replacing yes
end if
end tell
end try
end adding folder items toThis is attached as a folder action script to the backup folder on the Filemaker Server, and it's run whenever that folder is updated (which happens every night at 12:00 AM when Filemaker Server performs its scheduled backup). When the backup is complete, the Applescript first notices that that folder has been altered. This calls it into action. First, it checks to see what day of the week it is, and then moves the contained files to a folder of the same name on an external drive. So, if today is Monday, the backed up files will be moved to the "mon" folder on the external drive, and so on with the rest of the weekdays. On the following Monday, it starts again by overwriting the files already in the Monday folder (we only keep a week's worth of database backups around).
Now, I know there are more elegant ways to get this same routine done. I'm hardly a seasoned Applescripter. But this worked, so I thought I'd pass it on. I hope you found something useful here.
Incidentally, this same script has prompted me to devise a way to keep my desktop clean. I've attached it to a folder on my desktop I've labeled "to_dropbox." Anything dropped into that folder is moved, via the same daily routine, to a folder called "dropbox" on my external hard drive. At the end of the week, I can go through there and weed out what I want to keep, and what I want to trash. Plus, if I want to go back to a "Tuesday" version of a given file, I have it. Finally, it keeps the clutter off of my desktop.

![TUAW [Cafepress]](http://www.blogsmithmedia.com/www.tuaw.com/media/tuaw-cafepress-promo.png)


Reader Comments (Page 1 of 1)
Michael Haymore said 8:10AM on 10-06-2005
I wanted to inform you that it is possible to send different backups to different locations with FileMaker Server 7. You can set a default location in the settings to be on a different disk, but beyond that, you can set individual locations when you setup the schedules. I've done a lot of work with FileMaker, and I am very familiar with the server product.
Reply
Dave said 10:22AM on 10-06-2005
Michael: Then I'd very much like your assistance. All I want to do is schedule backups of my FM 7 databases to an external firewire hard drive, using FM Server 7's Scheduler. Whenever I try to identify a location outside of Scheduler's "default," the schedule does not run. Ideas? I appreciate it.
Reply
Michael Haymore said 2:38PM on 10-06-2005
Email me and I can help you troubleshoot this issue :) moop2000 [at] mac dot com
Reply