Skip to content
My built-in time machine solution
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Backup Script

#What it does This script will backup a directory (or your entire filesystem) in an incremental, space-efficient way. I use this script to backup my user directory, usually this is what you need.

the first time it will copy the whole directory on the external server, then it will copy only changed files.

For every backup, it will create a folder named after the date, for example 20161025-1452 (14:52 of 25/10/2016, dd/MM/yyyy). Next backups will hard link files that have not changed.

This script works even when you are not in your home network!


Don't forget to configure the server to accept ssh connections from your computer without password! The web is full of articles on how to do this, here's one.


  1. edit file com.michelenasti.scripts.backupscript.plist 
  2. set the paths with your directories
  3. launch ./


just ./

# How to launch?

Create a file, starting from

$ cp 
$ chmod +x 

Open the file and assign the right values to the variables.

Let's describe these variables with an example value

Name Example Description
SOURCE SOURCE=~ will backup the home directory for the user.
DEST_DIRECTORY DEST_DIRECTORY=personal_backup It is the directory where all the backups will be created. It will actually create another backup directory inside, so the actual backup directory will be personal_backup/backup/...
EXCLUDE_FILE EXCLUDE_FILE=./exclude.cfg have a look to this file if you want to exclude something
SSH_SERVER SSH_SERVER='' your server address
SSH_USER SSH_USER="admin" a user that can log on the server.
SSH_OPTIONS SSH_OPTIONS="-p 2222 if you have any options to log in on your server, for example by using a different port or wathever you pass to the ssh command, you can specify it here.

Once you have set up all these variables:

$ ./
You can’t perform that action at this time.