Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
"DIY Dropbox" or "2-way directory (r)sync with proper deletion"
tag: v0.1.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.



bitpocket is a small but smart script that does 2-way directory synchronization. It uses rsync to do efficient data transfer and tracks local file creation/removal to avoid known rsync problem when doing 2-way syncing with deletion.


Download script and place it in a directory in your $PATH:

$ curl -sL > ~/bin/bitpocket
$ chmod +x ~/bin/bitpocket

Setting up master

Create empty directory on some host that will be the master copy of your files:

$ ssh
$ mkdir ~/BitPocketMaster

Setting up slaves

On each machine you want to synchronize initialize empty directory as your bitpocket:

$ mkdir ~/BitPocket
$ cd ~/BitPocket
$ bitpocket init

Manual sync

Now whenever you want to sync with master just run bitpocket inside your bitpocket directory:

$ cd ~/BitPocket
$ bitpocket

Automatic sync with cron

Add following line to your crontab to run bitpocket as often as desired:

*/5 * * * * (cd ~/BitPocket; nice ~/bin/bitpocket >>.bitpocket/log)

Note that cron usually has very limited environment and your ssh keys with passhrases won't work in cron jobs as ssh-agents/keyrings don't work there. Thus it's preferable to generate passphrase-less ssh key for bitpocket authentication:

$ cd ~/BitPocket
$ ssh-keygen -t rsa -C bitpocket-`hostname` -N '' -f .bitpocket/id_rsa

and uncomment line with RSYNC_SSH in .bitpocket/config file.


Marcin Kulik / /

Something went wrong with that request. Please try again.