FolderSync2

  by Chris Handley
  For my email address, please see the "About the author" chapter.

CONTENTS


1. Introduction

The main purpose of FolderSync2 is to keep two sets of folders (on two different computers) synchronised, so that they are the same.

Why would you want to do that? Well, wouldn't it be useful to be able to access the same files on both computers? So you could use either computer (or even both) without worrying which computer had the files you wanted, or where they were, or whether they were out of date. Some situations where you might want this:

Network file shares do work in some of these cases, but they can be slow, unreliable, and definitely require that you have both your computers on at the same time (and on the same network). With FolderSync2 you only need to have them both on occasionally, when you perform a synchronisation.

This synchronisation is BI-DIRECTIONAL, which means that both computers (both sets of folders) get updated simultaneously. So you can change files on both computers, and then the next time you synchronise, the changes on each computer will get transfered to the other one. BEWARE that FolderSync2 cannot merge changes made to the SAME file, so you must try to avoid changing the same file on both computers (before a synchronisation is done).


FolderSync2 can also be used to perform incremental backups, where the changes only go in one direction. The backup can be a removable drive (perhaps a USB memory stick), a network drive, a separate partition, or just a folder on your harddrive.


Go back to CONTENTS


2. Important details

If you think that FolderSync2 could be useful, then the next step is to work-out exactly how you will use it. While FolderSync2 runs on one computer, it needs access to the other computer's folders. There are several ways you can do this:

(a) Running the free FTP server called FileZilla on a PC, and then using FTP Mount on the Amiga to give FolderSync2 access to the PC's files. I use this method all the time.

(b) Use SMBFS on the Amiga to give FolderSync2 access to normal Windows file shares. I have been told that this works (although 'foreign' characters don't yet work).

(c) Use NetFS on two Amigas, so that FolderSync2 can access the volume(s) of the other Amiga. I use this method quite a bit.

2.1. FTP Mount

Since older versions of SMBFS didn't work with Windows Vista or later, I've been using FTP instead, and have put a lot of effort into getting FolderSync2 to work flawlessly with the OS4 version of FTP Mount. (The OS3 version of FTP Mount may also work, but is not tested.) I strongly recommend using the free FileZilla FTP server for Windows, because FTP Mount does not work well with all FTP servers.

FTP Mount has a large number of limitations, most of which are due to limitations of FTP itself. The biggest limitations are that not only is it impossible to change a file's time stamp, but FTP Mount tends to show an out-of-date time stamp (until you disable & then re-enable it via Exchange). These two limitation mean that once FolderSync2 has finished, it is necessary to run a program on the other computer, to set the correct time stamps. And this unfortunately rules-out using FolderSync2 with remote FTP servers, such as web servers.


Go back to CONTENTS


3. Installation

On Amigas, installation is simple: Just copy FolderSync2 & FolderScan2 to somewhere in your command path, such Sys:C . If you wish to use the AmigaOS4, AROS or MorphOS native executables, please use the executables from the AmigaOS4, AROS or MorphOS folders instead. AROS users must use the AROS executables, since the 68k ones will not work.

On Windows, installation is a little more fiddly: While you can copy FolderSync2.exe & FolderScan2.exe to any folder you like, a Command Prompt won't find the executables unless they are (a) in the current directory, or (b) their folder has been added to the command path (i.e. the PATH variable).


The additional programs EasyFolderSync2, EasyBackup2 & ProfileWizard can be stored anywhere, but you need to keep the (iconless) EasyIcon.inf file in the same folder as them. Note that for AmigaOS3 the RequestString command must be copied to somewhere in your command path.


If you want to use FolderSync2 with SMBFS, then you can get it from here:

sourceforge.net/projects/amiga-smbfs/files/amiga-smbfs/

If you want to use FolderSync2 with NetFS, then you can get it from here:

aminet.net/package/comm/net/NetFS

If you want to use FolderSync2 with FTP Mount, then you can get it from here:

aminet.net/package/comm/tcp/FTPMount_os4

aminet.net/package/comm/tcp/FTPMount_MOS

aminet.net/package/comm/tcp/FTPMount


Go back to CONTENTS


4. A quick start

While FolderSync2 is essentially a Shell-only program, I provide some programs that allow you to use it without touching the Shell. They are called EasyBackup2, EasyFolderSync2 & ProfileWizard.

These programs do not work on Windows! And ProfileWizard does not work on AROS (probably due to lack of ARexx support).

4.1. EasyBackup2

This is the simplest program. When run it will show a requester for choosing the source folder (the one to be backed-up). Then it will show a requester for choosing the destination folder (where the backup will be stored). Then it will ask how much detail you want reported - at least initially I suggest "Everything", and then later maybe changing to "Summary" once you are comfortable that it works like you expect. Finally it will perform the backup you asked for:

If there would be any "destructive" changes (i.e. deleting or overwriting files), then it will open a window showing what changes will be made. Close this window, and you will see it asking whether it is OK to continue. Answer Y for yes, or N for no, followed by the Return key. It asks about all destructive changes because it has SafetyLimit=1 set (see the sub-chapter 6.1. Shell parameters for more details).

If you let it perform the backup, then you should see it report what it is doing. Press Ctrl-C if you wish to abort FolderSync2 at any point.


Once the backup has finished, it will ask whether you want to create an icon to run this command again. If you agree, then it will show a requester that lets you name the file & choose where to put it. Double-clicking on the resulting icon will run the backup again, without asking you any questions (unless there will be any destructive changes). You can edit this icon with NotePad (or another text editor) if you wish.

4.2. EasyFolderSync2

This is similar to EasyBackup. When run it will show a requester for choosing the first folder to synchronise, followed by the second folder to synchronise. Then it will ask how much detail you want reported - at least initially I suggest "Everything", and then later maybe changing to "Summary" once you are comfortable that it works like you expect. Finally it will perform the synchronisation you asked for:

If there would be any "destructive" changes (i.e. deleting or overwriting files), then it will open a window showing what changes will be made. Close this window, and you will see it asking whether it is OK to continue. Answer Y for yes, or N for no, followed by the Return key. It asks about all destructive changes because it has SafetyLimit=1 set (see the sub-chapter 6.1. Shell parameters for more details).

If you let it perform the sync, then you should see it report what it is doing. Press Ctrl-C if you wish to abort FolderSync2 at any point.


Once the sync has finished, it will ask whether you want to create an icon to run this command again. If you agree, then it will show a requester that lets you name the file & choose where to put it. Double-clicking on the resulting icon will run the sync again, without asking you any questions (unless there will be any destructive changes). You can edit this icon with NotePad (or another text editor) if you wish.

4.3. ProfileWizard

When FolderSync2 is asked to synchronise or backup a folder, it checks for a special text file called a Profile. A profile contains commands for FolderSync2, which allow you to tell it to ignore some (sub) folders, files or filetypes, amoung other things. ProfileWizard removes much of the need for using a text editor, as well as the need to remember what the commands are.

Since FolderSync2 synchronises two folders (and their sub folders), there are two profiles, one for each main folder. The same goes for backups done by FolderSync2.


When you start ProfileWizard it will ask whether you want to create or edit a Profile. Next it will ask for the Profile's folder.

Then, if you are creating a Profile, it will ask for the Profile's name - leave this at the default of "main" for now. Alternatively, if you are editing a Profile, it will ask for you to select the Profile's file, which will normally be called "FS_main_Profile.txt".


A big requester will now open, which allows you to choose to add a particular command, edit the profile using a text editor, or finish ProfileWizard. The choice of commands is:

You also have these options:

After you have added a command, the Profile will be checked to ensure you haven't added the same command twice. If there is a problem then it will be reported, and you will need to EDIT the Profile to correct the problem.


Go back to CONTENTS


5. FolderScan2 (NOT FolderSYNC2!)

If you are going to be syncing (or backing-up) over a network, you should know about FolderScan2, which has several uses.

5.1. Introduction

It's first use is it's "Scan" mode, that speeds-up the scanning of a remote (networked) folder, which can otherwise take a long time. If you run FolderScan2 on the (remote) computer that has this networked folder, using it's "Scan" mode, then it can quickly scan the folder & store the result in a file (since it's done locally, rather than over the network). FolderSYNC2 will then read this file (over the network), instead of slowly scanning the folder (over the network).

It's second use is it's "Update" mode, that must be done immediately after FolderSYNC2 is finished, which updates the files modified by FolderSYNC2, to ensure their timestamp exactly matches what FolderSYNC2 thinks it should be. If you don't do this, then you may find that FolderSYNC2 fails to work correctly over a network (typically with FTP). You should only use the "Update" mode if you have used the "Scan" mode.

The third use is it's "CheckProfile" mode, which simply checks that the Profile is valid. You might find this useful after editing a Profile.


PLEASE NOTE that if you are using FTP Mount, then you must use FolderScan2, otherwise FolderSYNC2 will not work. This is due to limitations of FTP Mount & FTP itself. Of course you cannot run it on a remote web server, so you can't use FolderSync2 with them.

5.2. Shell parameters

The Shell parameters of FolderScan2 are:

  Folder/A, ProfileName, Scan/S, Update/S, CheckProfile/S:

Here is what each of these parameters does:

5.3. Example usage

Here is an example of how you would use FolderScan2 & FolderSYNC2. Let's say that you have a folder on the remote computer (which has the FTP server running), who's path is Remote:folder . And on the main computer, let's say that when accessed via FTP it's path is FTPMount:remote/folder . And let's say that you want to synchronise this with a folder on the main computer who's path is Main:folder .

First, on the remote computer you would run this command:

  FolderScan2 Remote:folder SCAN

Then, on the main computer you would run something like this:

  FolderSYNC2 Main:folder FTPMount:remote/folder

Finally, on the remote computer again, you would run this command:

  FolderScan2 Remote:folder UPDATE

5.4. Special files

When FolderScan2 is run in Scan mode, it creates a special file for storing the scan result. Assuming you are using the "main" profile, it is called "FS_main_LastScan".

When FolderScan2 is run in Update mode, it expects to find a special file called "FS_main_LastUpdates" (created by FolderSync2).

When FolderScan2 is run in CheckProfile mode, it only reads the profile file.


Go back to CONTENTS


6. Shell usage of FolderSync2

If you want more control of FolderSync2 than EasyFolderSync2 or EasyBackup2 give you, then you will need to edit the icon created by them (or run FolderSync2 from the Shell). This chapter covers everything you should need to know.

6.1. Shell parameters

The Shell parameters of FolderSync2 are:

  Folder1/A, Folder2/A, ProfileName, NoAsk/S, SafetyLimit/N, Verbose/S, Terse/S,
  NoLog/S, BackupFolder/K/N, UTF8Folder/K/N, AllowTimeDif/K/N

Here is what each of these parameters does:

Note that if neither Verbose or Terse is used, then FolderSync2 only reports a summary of the changes made. You can still read the log file for full details of what was done, as the log acts as if Verbose was used.

6.2. Special files

FolderSync2 creates several special files in both main folders. Assuming you are using the "main" profile, then they are called:

6.3. Profiles

I will assume you have already read about the ProfileWizard (see the sub-chapter 4.3. ProfileWizard), so that you know what a profile is used for.

You might be wondering why profiles can have different names. It is to allow multiple profiles in the same folder. Why? So that 'power users' can synchronise a folder with more than one computer! Most people won't need this feature, so just leave the ProfileName at it's "main" default.


When you are creating/editing a profile in a text editor, you should know what FolderSync2 allows. Each line may contain one command, or a comment, or it can be empty. A comment is a line starting with a semi-colon:

  ;this is a comment!

Commands are a single word, followed by a gap (of one or more spaces/tabs) and some options. So they are quite similar to AmigaDOS scripts! The commands are read in order, starting at the top, although currently the order doesn't have any effect.


Note that if you ignore a file/folder in one main folder, you should not have such a file/folder in the other main folder, otherwise FolderSync2 will warn you. If that happens, then you need to ignore it in BOTH main folders (or delete one of them!).

6.4. Syncing using USB memory sticks

This is where "fun" with profiles starts! If you wish to sync two computers via a USB memory stick (or other removable writable media), then you need to have two profiles on it, one for each computer. For simplicity you should name the two profiles after the two computers that will be synced.

Say you have two computers, imaginatively named One and Two. Then the data transfer will look like this:

  computer One <===> USB memory stick <===> computer Two

To ensure that both computers are completely up-to-date, you must perform three synchronisations in this order:

In this case you would have profile One on computer One & the USB memory stick. While profile Two would be on computer Two & the USB memory stick. So when syncing computer One with the USB memory stick, you would run something like this:

  FolderSync2 Work:folder MemStick:folder ProfileName=One

And when syncing computer Two with the USB memory stick, you would run something like this:

  FolderSync2 Work:folder MemStick:folder ProfileName=Two

I should note that the ProfileName keyword is not required, so you could type this instead:

  FolderSync2 Work:folder MemStick:folder "Two"

6.5. Multi-computer syncing

It is possible to keep more than two computers synchronised. For simplicity you should designate one computer as the "master". Conceptually the USB memory stick took this "master" role in the previous sub-chapter. The method is also very similar to that described in the previous sub-chapter, with each computer having it's own profile.

The only real difference is the order in which you synchronise them. For N+1 computers (where computer N+1 is the master computer) it will look like this:

Followed by:

This could start to get quite laborious, and it would quickly become much easier to just have a shared network folder. But if this shared network folder is very slow or unreliable, then FolderSync2 gives you another option...


Go back to CONTENTS


7. Discussion

FolderSync2 is a complete rewrite of FolderSync1. Overall FolderSync2 is much more robust, idiot proof & flexible. FolderSync1 was written in AmigaE, while FolderSync2 is written in my PortablE programming language.

If you are performing a plain backup, then FolderSync2 is a bit like RoboCopy on Windows, except that FolderSync2 will usually spot renames & moves (and so can be much faster).

If you are performing a synchronisation, then FolderSync2 has very little competition. I have seen a few very crude alternatives on both Windows & Amiga, but they use very simple algorithms that can easily go wrong if you are not extremely careful, where as FolderSync2 should be (almost!) completely fool-proof. The only serious alternative is Microsoft's SyncToy, which works in a similar way.


Go back to CONTENTS


8. About the author

My name is Christopher S Handley, but you don't really want to hear about me do you? Suffice to say that I am an E programming fanatic, and live in England :-)

You can you can get my current email address from this web page:

cshandley.co.uk/email

Please do NOT post my email address in public, because I might get spammed.


Go back to CONTENTS


9. History

r1 (31.05.2016)

r1 beta (06.12.2009)