Home / Blog / Use System Level Scripts to Archive Backups or FTP Import with FileMaker Server

Use System Level Scripts to Archive Backups or FTP Import with FileMaker Server

System level scripts can be very helpful to use with FileMaker Server. There are two problems I was able to solve by using system level scripts, and now I use these two processes on a daily basis. The first problem I came across was that the server machine was always running out of memory.

To solve this, I created a process that creates a zip file of my backup. It then move the backup to another machine. The second issue I came across was a client needed to refresh FileMaker data from another data source on a nightly basis.

Using ftp to access a machine and then grabbing a file to import it into FileMaker solved this request. I will go into how to do each of these in detail.

Creating Zip Files of the Backup and Moving Them to Another Location

This example assumes you are on a Mac.

  1. First, set up a schedule that keeps only one backup in the folder. In this example, I call that backup “ScriptedBackups.” For this particular client, I have a development FileMaker file and a production FileMaker file, so I need to create a back up schedule for each one with it’s own separate folder:
    1. /Volumes/Server HD/Library/FileMaker Server/Data/Backups/ScriptedBackups/Production/
    2. /Volumes/Server HD/Library/FileMaker Server/Data/Backups/ScriptedBackups/Development/
  2. Once you have the backup schedule ready, you can create the shell script to zip up the file and then move it to the proper location. Put the scripts in the scripts folder within FileMaker Server (Library/FileMaker Server/Data/Scripts/).  The set of scripts available below were written by Jeremiah Small (thank you!). The zip_daily.sh script defines 2 variables:  the starting path and the target path. You need to update those 2 paths, and the path to the worker script. The shell script will call the worker script to do all the work; it also adds data to the logger, so you can monitor results. zip_dailysh.sh zip_workersh.sh. A worker script allows you to create as many calling scripts as you wish. You only have to update the two paths. For example, we use a zip_daily.sh, zip_hourly.sh, zip_monthly.sh, and a zip_weekly.sh, and they all call the same worker script.
  3. Create a new schedule that calls the system level script appropriately. If you call your script zip_daily.sh, create a schedule that calls the script daily.
  4. Test Now you are done!


  • FileMaker server always runs scripts from the root, so file paths need to be absolute, not relative.
  • You can also use this same logic to create a schedule that deleted files that are older than x number of days. For example, see purge_183dayssh.txt and purge_workersh.sh (In this calling file, you will need to update all the filepaths).

FTP into Site and Move Files Locally to Import

The example assumes you are on a PC.

  1. First thing to do is create the scripts to ftp into a server and grab a file. Thank you to Mason Dixon for creating these scripts. He set it up so there is a calling batch script and a corresponding text file with the information. For this example, I want to grab unit_import.csv from the ftp site and move it locally to my documents folder inside of FileMaker server. In the text file, edit the ftp site, user name, password, and destination path as desired. Make sure the path and name of the text file are correct in the batch file. The scripts should be living in “C:Program FilesFileMakerFileMaker ServerDataScripts” and the data files should be living in “C:Program FilesFileMakerFileMaker ServerDataDocuments” doftp_unit_importbat.txt ftpdirectives_unit_import.txt
  2. Once you have your scripts in place, you want to create a FileMaker Server schedule. The trick here is to use a script sequence schedule, because you don’t want to import the data until the import file has completed its move to the local machine. Create a script sequence to call the batch script you created in step one and then call an import script from FileMaker.
  3. Test Now you are done!


  • This example assumes the import filename and location never changes.
  • In the system level scripts, the filename is case sensitive, so be sure it matches the name of the file on the FTP server.
  • If the file to be imported doesn’t live in the root of the ftp site, then you can change directory by adding “cd newdirectory” to the text file, before the lcd step.
  • If you have issues moving the file from the ftp site, make sure to add ftp.exe as an exception to your firewall.
  • You can also use the same logic to export a file from FileMaker, and then move it to an ftp site. For example, see doftp_local_law_exportbat.bat and ftpdirectives_local_law_export.txt.

I hope you find this as useful as I did. I’d be happy to answer any questions via comments or email:  mencarnacao@soliantconsulitng.com

Thanks for reading!

Makah Encarnacao

6 thoughts on “Use System Level Scripts to Archive Backups or FTP Import with FileMaker Server”

  1. Hi Makah & Jeremiah

    Thanks for those, most useful for the toolbox (esp PC ftp – not my native tongue)

    Just discovered collapsible list post too, very cool.


    London, UK

  2. Thank you very much!

    I try to create my first Filemaker Server Systemlevel Script.
    But it always stops with the Error “Aborted by user”.

    Do you have any idea what i can do?

    (i have tried the default user, and also an Admin-User)



  3. Makah Encarnacao

    Hi Andreas, do you have a time limit on your schedule?  Have you tried extending that time or turning that limit off?

  4. Thank you for the info!

    How do I create a Filemaker script that calls for an import from that specific file. I can’t seem to get filemaker to recognize the file path.


  5. Hi,

    Your script runs until the following point on my computer

    “Thors-MacBook-Air:/ Thor$ /Library/FileMaker\ Server/Data/Scripts/zip.worker.sh
    ln: /tmp/soliant001.ln: Invalid argumen”

    How would I modify it to run correctly?



  6. Makah Encarnacao

    Hi John, 

    zip_workersh.sh should not have to be modified. But any scripts that call this script will need to be modified. Have you updated the calling script correctly? It seems like it might be a path issue.

Leave a Comment

Your email address will not be published. Required fields are marked *