1. What is PlatSync?

It's primarily a backup and restore program, similar to many others that are out there. You can do full and incremental backups, and you can restore from any previous backup. One of the things that is a little different about PlatSync is that it's designed to back up multiple machines to a single repository, automatically detecting duplicates and storing only one copy. I have several machines at home and at work, all containing many of the same operating system and application files, so this "single instance store" aspect can yield significant savings on my backup media. It's also helpful when I'm backing up my multiple photo archives and can't remember what I've already saved.

As I was working out the design for detecting duplicates and only storing them once, I realized that it was a very short step from the basic backup/restore functionality to include directory-synchronization (sync) functionality for which I was already using a separate program. The classic sync example is bookmarks/favorites. I try to keep the same set of bookmarks on all of my machines. If I add/change/delete a bookmark, I want that change to propagate to my other machines. At first you might think this is trivial; if it exists on machine A and not on B, just copy it over. That's great for additions, but what if it doesn't exist on B because it was deleted on B? What if it exists on both, but the contents are different? To deal with that you need to know not two states for A and B but also the previous state when they were last identical. Then you have the really difficult case where it was changed on one since that common point in the past, but deleted on the other. What then? I use a very simple set of rules:

These rules are a little different than those in some other synchronization programs, which go out of there way to avoid deleting a file that might not exist somewhere else. I can afford to be more cavalier about this because it's part of a backup program. All previous versions of a directory, including partially synchronized versions, are just a restore away. If something gets deleted, I can just restore into an empty directory somewhere and pick out the files I still want.

2. Installing and Running

PlatSync is available in two forms: as Python source for any platform, or as a standalone GUI for Windows. To use the standalone version all you need to do is unpack the archive and run platsync.exe. To use the source you will need the following:

Installing PlatSync from source is just a matter of unpacking the archive to a directory somewhere. To run, all you need to do run on of the following commands:

I'm not going to explain the CLI arguments in a lot of detail, because I'm lazy. Just run the command above and it'll show you some help that you should be able to match up with the GUI descriptions.

3. Tkinter GUI

The first thing you'll see when you run the GUI is a dialog box prompting you for a working directory and repository. The working directory is some directory full of your files that you'll be backing up or synchronizing, or one that you'd like to be full of your files for a restore. The repository is a directory that you've created where PlatSync will store its internal information and copies of your files. You can select from a list of recently used directories, type in a directory name yourself, or click one of the "Browse" buttons to use a fairly lame file-selection dialog (not my fault; it's from one of the standard Python libraries). After you've selected the two directories, click on one of the action buttons at the bottom.

3.1. Backing Up

For a backup, you need to specify the name for a "map" which will describe the contents of your directory at the present point in time. This is just something you have to decide on for yourself, though the field is seeded with a value that I intend to be (a) unique and (b) useful. You can also set a couple of flags affecting how the backup operates:

Once you've chosen a map name and decided on appropriate settings, just click on the "Go!" button to do your backup.

3.2 Restoring

When you go to restore, you'll be shown a list of maps that exist in the specified repository. All you need to do is select one (this is why it's useful to embed the date in the map name) and click the "Go!" button.

3.3 Synchronizing

Synchronizing is almost exactly like backup up, except that non-overlapping changes in the repository (the result of synchronization from somewhere else) will also get propagated into your working directoty. The same options apply as for backing up, but the "check archive flag" setting works a little differently. When this box is clear, PlatSync will do a full scan of your working directory looking for changes. When the box is checked, it will use a faster method; it will fetch a map from the repository representing the last time you backed up or synchronized, and then modify that map for files that have their archive flag set. This is faster than the full-scan method, and works so long as nobody has been messing around in the repository (not counting PlatSync's own operations) but if such messing around has occurred it can miss changes.

4. wxPython GUI

The organizing concept for the wxPython GUI is of a backup or synchronization "task" which contains the following information:

Tasks are represented visually as a row of labelled icons along the bottom of the PlatSync window. When one is created or selected, the corresponding settings are loaded into the main part of the window. The directory names can be entered directly, or you can browse using the buttons on the right. When you're ready to run the task, just click the "run" button.

Task information is currently saved only when you click the "save" button. If you select or create another task, you will not be prompted to save the previously selected task, even if it's modified; any modifications will simply be lost.

4.1 Restoring

Restoring from a previous sync or backup is simple. First, select the task you want to base the restore on (or create a new task). Only the two directories really matter; the flags are ignored. Second, click the "restore" button. You will be presented with a list of map files in the repository. Each map file, if it was created using the wxPython GUI or with the Tkinter GUI using the default values, will contain the following information embedded in the file name (in order):

This information should allow you to select the map corresponding to the version of the working directory that you want to restore. Simply select it, click "OK" and the restore will be done.

5. Information for Hackers

PlatSync stores three kinds of files: in the repository except for one case where it's in the working directory:

6. Limitations and Future Work

Because of the way map pointers are stored, it's not a good idea to sync to the same repository from multiple working directories on the same machine (it's designed to sync from multiple working directories on different machines). Eventually I'd like to change the map-pointer handling to make this more of an option.

While PlatSync is designed to support backing up or synchronizing from multiple machines, it's not really designed to support doing so simultaneously. Eventually I'll add locking and possibly more complex internal data to support this.

It shouldn't be prohibitively difficult, and I think it would be quite handy, to make PlatSync access the repository via FTP.

I'd like to add a continually updating status bar, a cancel button, better logging of actions, and save/restore for file permissions as well as contents.

5. Disclaimer

OK, here's the money question. Can or should people trust their data to PlatSync? No, not yet. This is still very early in development. There are probably a lot of error conditions I don't catch yet, or don't handle properly. I haven't actually tested it on Linux yet. I haven't used it for any really big directories. I think it's off to a good start, I trust the backup functionality not to mess up existing data, but I wouldn't yet count on it as my sole means of protecting data I really care about. The sync function does have the ability to delete files, so extra caution is called for if you use it. This is very much "caveat emptor" stuff. If you're comfortable giving it a try, and you're covered in case it doesn't do quite what it should, that's great, but if you're looking for a mature program this isn't it. I recommend Backup4all as a nice, simple, and relatively inexpensive Windows backup program. I do not recommend Retrospect, which once lost a catalog file (in a proprietary format) and thus any ability to restore from that archive; fortunately I had recent-enough copies of everything in that archive elsewhere so it wasn't a total disaster. For file synchronization I recommend FileSync and FTPSync from FileWare. While I seek to replace both of these programs with my own eventually, the authors of these fine programs deserve congratulations and support for their efforts.