Automating FileMaker Backups to Google Drive with Python and Rclone
Introduction
In this article, I want to share a real-world solution I developed to automate the backup of FileMaker files (.fmp12) from a Windows Server to Google Drive. The goal was to create compressed, date-stamped archives of all relevant files, upload them efficiently, and keep the process fully logged and monitored. The solution uses Python, Rclone, and optionally 7-Zip.
The script only processes FileMaker files that have already been backed up by FileMaker Server’s internal routine — not live production files. This ensures maximum safety and avoids interfering with open databases.
What are FileMaker, Python, Rclone, and 7-Zip?
- FileMaker is a cross-platform database solution developed by Claris (Apple) used to build custom apps for managing business workflows, with a graphical interface and scripting features.
- Python is a high-level programming language ideal for automation and scripting tasks.
- Rclone is a command-line tool to sync files with various cloud services including Google Drive.
- 7-Zip is a powerful open-source file archiver, used to compress large files efficiently and reliably.
Requirements
- Python 3.10+
- Rclone configured with access to Google Drive
- Optional: 7-Zip for large file handling
- SMTP credentials for email notifications
Main Features
- Daily search for
.fmp12files in a source directory (and subfolders) - Creation of ZIP files with timestamped filenames
- Parallel compression using Python’s built-in
zipfileand optionally 7-Zip - Upload to Google Drive in a structured folder (organized by date)
- Automatic cleanup of local ZIP files after upload
- Email notifications at start and end with full logs
Core Code Overview
1. File Search and Compression
from zipfile import ZipFile
import os
from datetime import datetime
def compress_file(filepath, output_folder):
filename = os.path.basename(filepath)
date_str = datetime.now().strftime("%Y-%m-%d_%H-%M")
zip_filename = os.path.join(output_folder, f"{filename}_{date_str}.zip")
with ZipFile(zip_filename, 'w') as zipf:
zipf.write(filepath, arcname=filename)
return zip_filename
2. Upload to Google Drive
import subprocess
def upload_to_gdrive(local_path, remote_folder):
result = subprocess.run(["rclone", "copy", local_path, remote_folder], capture_output=True)
return result.returncode == 0
3. Email Notifications
import smtplib
from email.mime.text import MIMEText
def send_email(subject, body):
msg = MIMEText(body)
msg["Subject"] = subject
msg["From"] = "backup@yourdomain.com"
msg["To"] = "you@yourdomain.com"
with smtplib.SMTP("smtp.gmail.com", 587) as server:
server.starttls()
server.login("your_email", "your_password")
server.send_message(msg)
Results
The system has been tested with over 60 .fmp12 files and worked flawlessly. All files were compressed, uploaded to a daily folder in Google Drive, and removed locally to save space. The process is fully automated and can be scheduled with Task Scheduler.
✅Example of Log backup report
Date: 2025-08-06
Total Files Processed: 3
Errors: 0
Target Folder: gdrive:/bk_rclone/filemaker_fmp12/python_backup/2025-08-06
📄 Log Summary:
2025-08-06 20:00:02 – INFO – === Inizio backup FileMaker === 2025-08-06 20:00:03 – INFO – Trovato file: gestionale_rimec.fmp12 (2.9 GB) 2025-08-06 20:01:12 – INFO – Creato archivio ZIP: gestionale_rimec_2025-08-06_20-00.zip 2025-08-06 20:10:15 – INFO – Caricato su Drive: gestionale_rimec_2025-08-06_20-00.zip 2025-08-06 20:11:08 – INFO – Trovato file: ordini_produzione.fmp12 (1.5 GB) 2025-08-06 20:12:01 – INFO – Creato archivio ZIP: ordini_produzione_2025-08-06_20-00.zip 2025-08-06 20:13:56 – INFO – Caricato su Drive: ordini_produzione_2025-08-06_20-00.zip 2025-08-06 20:14:01 – INFO – File ZIP locali rimossi 2025-08-06 20:14:01 – INFO – === Backup COMPLETATO ===
— Automatic backup script via Python + Rclone
Who I Am
I’m Genesio, co-owner of a mechanical engineering company in Northern Italy. I work daily with FileMaker, custom software, CNC machines, and production automation. My goal is always to improve processes using reliable and flexible solutions — and this backup system reflects that philosophy.
Conclusion
If you use FileMaker and want to automate backups to the cloud, this Python + Rclone solution is efficient, transparent, and fully customizable. Let me know if you’d like a copy of the full script or if you’re interested in automating the recovery process as well.
Company Links
These are the websites of my mechanical production company, where we design and manufacture CNC custom parts and develop automation tools:
www.rimecsrl.it – Italian version
www.cnccustomparts.net – English version
Leave a Reply