FreeFileSync
- Folder Comparison and Synchronization -

Usage:

  1. Choose left and right directories.

  2. "Compare" them.

  3. Select synchronization settings.

  4. Press "Synchronize..." to begin synchronization.

Main Dialog:

  1. Start comparison

  2. Specify comparison settings

  3. Set sync configuration

  4. Start synchronization

  5. Select left and right directories

  6. Swap sides

  7. Add additional folder pairs

  8. Exclude files

  9. Save/load configuration

  10. Synchronization statistics/preview

Menu bar:

Menu "File"

  • 1. Compare
    Start comparing both sides according to comparison settings (compare by filesize and date or by content).

  • 2. Synchronize...
    Begin synchronization and copy files as seen on the middle grid of the main dialog.

  • Switch View
    After comparison has finished the relation between files on left and right side can be visualized by two views:

1. „Comparison Result“ shows a category for each row like „existing on left side only“ or „left file is newer“.

2. „Synchronization Preview“ is the result of the synchronization configuration applied on each category. The effective directions in which the files will be copied are shown.

  • New
    Clears all configuration data and restores an initial state.

  • Save Configuration...
    Save the current settings into a file.

  • Load Configuration...
    Load configuration from file.

  • Quit
    Exit FreeFileSync.

Menu "Advanced"

  • Language
    Change the language of the tool.

  • Global Settings...
    A number of settings that have a global status in the sense that they will be applied to all GUI and batch configurations (*.ffs_gui and *.ffs_batch).

  • Create Batch Job
    Creates a FreeFileSync batch file (*.ffs_batch) that executes a predefined synchronization without user intervention.

  • Export File List...
    Export all data that     is currently shown on the main grids as a *.csv file that can be imported into Excel.

Menu "Help"

  • Content
    Show this helpfile.

  • Check for new version
    Check online whether a more recent version of FreeFileSync is existing.

  • About...
    Credits.


Key Features

  1. Compare files (bytewise or by date) and synchronize them.

  2. No limitations: An arbitrary number of files can be synchronized.

  3. Unicode support.

  4. Network support.

  5. Built-in support for very long filenames (more than MAX_PATH = 260 characters)

  6. Synchronization database for propagation of deleted files and conflict detection

  7. Support for multiple folder pairs with distinct configuration

  8. Full support for Windows/Linux Symbolic Links and Windows Junction Points.

  9. Lean & easily accessible UI: Highly optimized for speed and huge sets of data.

  10. Algorithms coded in C++ completely.

  11. All progress indicators optimized for maximum performance!

  12. Create Batch Jobs for automated synchronization with or without GUI.

  13. Focus on usability:

    1. Only necessary functionality on UI: no overloaded menus or icon jungle.

    2. Select all folders via drag & drop.

    3. Last used configuration and screen settings are saved automatically.

    4. Maintain and load different configurations by drag & drop, load-button or commandline.

    5. Double-click to start external application (e.g. show file in Windows Explorer)

    6. Copy & paste all grid data as text

    7. Delete superfluous/temporary files directly on main grid.

    8. Right-click context menu.

    9. Status information and error reporting

    10. Sort file-lists by name, size or date.

  14. Support for filesizes larger than 4 GB.

  15. Option to move files to Recycle Bin instead of deleting/overwriting them.

  16. Ignore directories "\RECYCLER" and "\System Volume Information" with default filter. (Windows only)

  17. Localized versions are available for many languages.

  18. Delete before copy: Avoid disc space shortages for large sync-jobs.

  19. Filter functionality to include/exclude files from synchronization (without requiring a re-compare!).

  20. Include/exclude specific files from synchronization temporarily.

  21. Create sync jobs via GUI to synchronize automatically (can be scheduled or executed via double-click).

  22. Handle daylight saving time changes on FAT/FAT32 volumes correctly.

  23. Portable version available.

  24. Native 64-Bit version.

  25. Check for updates from within FreeFileSync automatically.

  26. Copy locked files using Windows Volume Shadow Copy Service. (Windows only)

  27. Create regular backups with macros %time%, %date% within directory names

  28. Copy file and folder create/access/modification times when synchronizing


Links

Homepage:

http://freefilesync.sourceforge.net

FreeFileSync on SourceForge:
http://sourceforge.net/projects/freefilesync

For feedback, suggestions or bug-reports you can write an email to:
zhnmju123 [at] gmx [dot] de

Or report directly to:
http://sourceforge.net/tracker/?group_id=234430

Support the FreeFileSync project:
Paypal


Batch Scripting (Windows)

In order to facilitate using FreeFileSync and RealtimeSync in advanced synchronization scenarios, creating batch files is a good way to provide additional functionality. The following section will give some general hints for custom *.cmd and *.bat files.

Example: (A simple locking facility when sync'ing with multiple computers in parallel)

    :tryAgain
    if not exist \\share\folder\lock (
          ::create the lock
     echo This is a lock file > \\share\folder\lock
          ::execute the synchronization batch job synchronously
          "C:\Program Files\FreeFileSync\FreeFileSync.exe" "C:\MySyncJob.ffs_batch"
      del \\share\folder\lock
    ) else (
          ::wait 5 seconds then try starting sync again:
     choice /C:AB /T:5 /D:A > NUL
      goto tryAgain
    )

  1. When starting a batch file from RealtimeSync be sure to make synchronous calls to FreeFileSync only. This will prevent RealtimeSync from detecting changes while synchronization is still in progress.

  2. During execution of a Batch file a black console window is shown. You can hide this window by using the Visual Basic script "Invisible.vbs" located in the FreeFileSync installation directory.

    Usage:

    wscript C:\Program files\FreeFileSync\Invisible.vbs C:\MyBatchFile.cmd

  3. FreeFileSync returns with an Errorlevel below zero if unresolved problems remain:

    "C:\Program Files\FreeFileSync\FreeFileSync.exe" "H:\Silent_Config.ffs_batch"
    if not errorlevel 0 (
          ::if something went wrong, add special treatment here
      echo Errors occurred during synchronization...
      pause
    )


Compare by filesize

Sometimes you might want to compare both sides by filesize only, ignoring last modification timestamps.

Instructions:

Open your *.ffs_gui configuration file and change the value of XML node <FileTimeTolerance> to some sufficiently large number of seconds. Changed files will now be detected as a conflict (same date, different filesize) and the default synchronization direction for conflics can be used.


Daylight saving time

The Windows operating system exhibits quite a unique behavior when handling timestamps on NTFS file systems. This leads to a well-known issue that all file synchronization software has to handle:

During daylight saving time switching, (local) file times are shifted by one hour on NTFS file systems, while NO shift occurs on FAT/FAT32 drives (as used by most USB sticks)! Thus when synchronizing an NTFS against a FAT32 volume file times become asynchronous twice a year!

For a comprehensive discussion about this issue refer to:
http://www.codeproject.com/KB/datetime/dstbugs.aspx

Solution:

In order to avoid re-copying files that have a modification time difference of +-1h FreeFileSync offers a global option: Menu -> Advanced -> Global settings: Ignore 1-hour file time difference.

If "Ignore 1-hour file time difference" is checked, all files with a +-1h difference are treated as having the same time. This also handles different file time precisions (NTFS: 100ns, FAT/FAT32: 2 seconds) by allowing a 2 second tolerance .

Files that have a deviation of less than one hour are categorized as conflicts. The reasoning is that these files surely have been modified on at least one side since last synchronization. But during one of the two daylight saving time switches per year the older file is shown pretending a newer date which can lead to data loss (when using the rule to overwrite older with newer files).

Note:
If synchronization takes place between NTFS ↔ NTFS or FAT32 ↔ FAT32 this checkbox provides no advantage and can be left unchecked.


Drag & drop support

FreeFileSync takes usability very seriously. Therefore drag & drop is supported in various situations:

Example:

    • drag & drop a directory onto the main window to set the directory for comparison

    • drag & drop a file onto the main window to set the directory for comparison

    • drag & drop *.ffs_gui files onto the main window to load the configuration contained

    • drag & drop *.ffs_batch files onto the main window to display and edit the batch configuration

    • drag & drop *.ffs_batch files onto the batch dialog to display and edit the batch configuration


Environment Variables

All directory names may contain macros that are expanded during synchronization. Begin and end of each macro is marked by a '%' character. Besides special macros handling time and date (see "Time-stamped directories"), the operating system's environment variables can also be used.

Example:

    • C:\Backup\%USERNAME%_Config expands to
      C:\Backup\ZenJu_Config

    • %APPDATA%\FreeFileSync      expands to
      C:\Documents and Settings\ZenJu\Application Data\FreeFileSync

Hint:

You can add a great amount of flexibility to Batch Synchronization (*.ffs_batch) by creating new temporary environment variables in a *.bat/*.cmd file that are evaluated by FreeFileSync at runtime!

Example:

The batch configuration file C:\SyncJob.ffs_batch contains macro %MyVar% instead of an absolute target directory and is invoked by a *.cmd file:

      set MyVar=C:\Target
      cd "C:\Program files\FreeFileSync"
      FreeFileSync.exe C:\SyncJob.ffs_batch       (->%MyVar% is replaced by C:\Target during execution)

    Note:
    Temporary environment variables created with the "set" command are only valid if the batch job is started by calling the executable directly! Using "start /wait" or relying on Shell Execute creates a new program context without these temporal variables.


Synchronize in Batch Mode and send error notification via email

  1. Create a FreeFileSync batch file using "Silent mode".

  2. Set error handling to "Exit instantly" or "Ignore errors" to avoid having a popup stop the program flow. In case errors occur FreeFileSync will exit with a returncode < 0 that can be checked via the ERRORLEVEL batch command.

  3. Create a *.cmd or *.bat file to specify the location of FreeFileSync.exe and pass the name of the FreeFileSync batch file as first argument; e.g.:

      "C:\Program Files\FreeFileSync\FreeFileSync.exe" "C:\SyncJob.ffs_batch"
      @if not errorlevel 0 (
          echo An error occured!
          pause
      )

Instead of displaying "An error occurred!" you can specify any other command like sending an email notification (using a third party tool).


Exclude subfolders from synchronization

In order to synchronize all files from base synchronization directories excluding all subfolders, simply set up a filter like this:

Include: *
Exclude: *\

This will exclude all objects within the two directories that end with a '\' character, which is interpreted as the end of a directory name.


Start an external application via double-click

FreeFileSync opens the operating system's standard file browser per default on each double-click e.g. by invoking "explorer /select, %name" on Windows.

If some other application shall be started instead, just navigate to "Menu -> Advanced -> Global settings: External Applications" and add or replace a command string. The first one is used when double-clicking while all subsequent entries are still available in right-click context menu on main dialog. The following macros are available:

    %name   - full file or directory name
    %dir    - directory part only
    %nameCo - Other side's counterpart to %name
    %dirCo  - Other side's counterpart to %dir

Example:

    • Start associated application: cmd /c start "" "%name"

    • Start visual difference tool: C:\Program Files\WinMerge\WinMergeU.exe "%name" "%nameCo"

Note:
Don't forget to use quotation marks if file names contain spaces!


RealtimeSync

RealtimeSync's primary function is to trigger synchronization immediately after files in a source directory have changed. However its implementation is much more flexible to cover an even broader range of use: A list of directories provided by the user is monitored for changes. Whenever a file within these directories or subdirectories is modified OR the directory becomes available (e.g. insert of a USB-stick), RealtimeSync responds by executing the user-specified command line.

Example: (Real time synchronization - in combination with FreeFileSync)

First start up RealtimeSync.exe located in FreeFileSync's installation directory. Then specify all directories that shall be monitored. Instead of doing this manually you can simply import a *.ffs_batch file via Menu -> File -> Load configuration. This not only extracts all directories relevant for synchronization but also sets up the command-line to execute the *.ffs_batch file every time changes are detected. Now press "Start" to begin monitoring.

      Note:

    • Using RealtimeSync is not restricted to starting FreeFileSync. It can also be used in other scenarios, like sending an email whenever a certain directory is modified.

    • Starting the tool can be automated by passing a RealtimeSync configuration file (*.ffs_real) OR a FreeFileSync Batch file (*.ffs_batch) as first command-line argument. Latter is implicitly converted to a *.ffs_real file with default settings. This allows for integration with your operating system's autostart facility:

    "C:\Program Files\FreeFileSync\RealtimeSync.exe" "C:\MyConfig.ffs_real"
    "C:\Program Files\FreeFileSync\RealtimeSync.exe" "C:\SyncJob.ffs_batch"

Example: (Smart synchronization when USB sticks are inserted into your PC - in combination with FreeFileSync)

Assume you have multiple(!) USB sticks that contain data you want to automatically synchronize in two-way mode whenever you insert one of the sticks into the PC. In order to be on the safe side, you decide to setup FreeFileSync batch jobs (*.ffs_batch) using <Automatic> mode so that conflicts, for example files modified on both sides, are detected avoiding data loss. Save the relevant configuration on each USB stick's root directory to have it called when the stick is mounted. Then configure RealtimeSync analog to the following:

Whenever directory "H:\Data" becomes available, the command-line executes and starts the batchjob whose configuration is located on the stick. Furthermore it also starts the batch job each time files are modified within "H:\Data".

For additional convenience it might be nice if the batch job remains silent if synchronization completes successfully, otherwise shows FreeFileSync's GUI dialog when errors occurred. Therefore create two configurations, one silent-mode batch to be called by default and one *.ffs_gui to be called when former fails. Then replace the command-line to simply execute a batch file similar to this one:

    ::first check whether USB-stick contains a sync-configuration at all
    @if exist "H:\Silent_Config.ffs_batch" (
     ::configuration found, now execute the synchronization batch job
     "C:\Program Files\FreeFileSync\FreeFileSync.exe" "H:\Silent_Config.ffs_batch"
     @if not errorlevel 0 (
     ::if something went wrong, start FreeFileSync in GUI mode
     "C:\Program Files\FreeFileSync\FreeFileSync.exe" "H:\GUI_Config.ffs_gui"
     )
    )


Run RealtimeSync as a Service (Windows only)

The following step-by-step guide describes how to setup RealtimeSync (or any other application) as a Windows Service. This can be useful if the tool shall run on a SYSTEM account without necessarily requiring a user to log in.

1. Get access to the command-line tools "instsrv.exe" and "srvany.exe" which come with the Windows Server 2003 Resource Kit Tools:

Download: http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en

2. Create and register a new Service via command line:

    instsrv <ServiceName> <PathToResourceKit>\srvany.exe

3. Link the new Service with RealtimeSync:

  • Open the Registry editor (Regedit.exe) and navigate to key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<ServiceName>"

  • Add a new key "Parameters".

  • Add a new String value named "Application" and specify a command line that shall be executed as value.

That's it!

Attention:
When running RealtimeSync as a service the application has no means to interact with the user. Therefore any popup dialog will stop the process flow! Consequently consider the following rules when setting up a FreeFileSync batch job:

  • Enable checkbox "Silent mode" to prevent showing a status dialog at the end of the process.

  • Set "Error handling" to either "Exit instantly" or "Ignore errors".

The new service can now be started via commandline or Windows Service administration:

    net start <ServiceName>

Note:
By default the service is created with startup type "automatic" which runs it on Windows start. This behavior can be changed in Windows Service administration.

If the Service shall be removed from the system, enter via command line:

    instsrv <ServiceName> remove

(Reference: http://support.microsoft.com/kb/137890)


Schedule Batch Job in Windows Task Planner (Windows XP)

  1. Create a new batch job via FreeFileSync's main dialog:
    Menu->Advanced->Create batch job and save it, for example, as "C:\SyncJob.ffs_ batch".

  2. Make sure you enable checkbox "Silent mode" to prevent showing a status dialog at the end of the process.

  3. If you want to avoid error or warning popup messages from stopping the process set "Error handling" to either "Exit instantly" or "Ignore errors".

  4. Start Windows Task Scheduler: Go to Start->Control Panel->Scheduled Tasks and select "Add Scheduled Task".

  5. Follow the wizard and choose "C:\SyncJob.ffs_batch" as program to run.

    • If you are using the locally installed version of FreeFileSync, *.ffs_batch files are automatically associated with the tool and field "Run:" can be directly filled with the filename:
      "      C:\SyncJob.ffs_batch"

    • If file associations have not been set (portable installation), "Run:" has to be prefixed with the executable:
      "D      :\FreeFileSync\FreeFileSync.exe" "C:\SyncJob.ffs_batch"


Symbolic link handling (Windows since Vista and Linux)

FreeFileSync offers three advanced options to configure processing of Symbolic Links (also called Symlinks or Soft Links):

  • "Ignore" excludes Symbolic Links while scanning the input directories.

  • "Direct" configures synchronization of the Symbolic Link object itself and not its target. Symbolic Links will be visible on main grid as a separate entity with corresponding metadata. Links pointing to directories are not traversed and the Link object is copied directly during synchronization.

  • "Follow" dereferences Symbolic Links, i.e. they are treated like their target objects. Links pointing to directories are traversed like ordinary folders and the target of each Link is copied during synchronization.

Note:

  • In the Windows build the options described above always apply to "Reparse Points". Reparse Points are a more general concept including for example Symbolic Links, Junctions and Mount Points. The term "Symbolic Link" has been retained nevertheless for harmonization with Linux.

  • Creating or copying Symbolic Links requires the application to be started with Administrator rights.


Synchronize with FTP

FreeFileSync does not support FTP directly. But the FTP functionality can be easily integrated by mapping the FTP webspace to a drive letter:

Example: Use the free utility NetDrive (http://www.netdrive.net)

  • Add a "New Site" and specify site name, site URL, drive letter, account and password.

  • Use the newly created drive as if it were a regular hard disk.

Note:
Most FTP drives set a file's timestamp to the current time when synchronizing ignoring the source file's time and date. As a workaround you can do a "compare by filesize"; see corresponding section.


Create regular backups with time-stamped directory names

You can use macros %time%, %date% within directory names you want to synchronize.

Example:

Let's assume you have a directory "C:\Source" which you want to backup each day into a time-stamped target directory like "C:\Target_2009-10-08". All that needs to be done is setting up base directories like these:

      Source folder: "C:\Source"
      Target folder: "C:\Target_%date%"

Latter will be interactively replaced with the current date during synchronization. In order to further automate this process, you can create a *.ffs_batch file with this configuration and choose "ignore errors" to avoid the warning that target directory is not (yet) existing.


Synchronize USB sticks with variable drive letters

USB sticks often have different volume names assigned to them when plugged into two distinct computers. In order to handle this flexibility FreeFileSync is able to process directory names relative to the current working directory.

Thus the following workflow is possible:

    1. Replace the absolute USB directory name in your configuration by a relative one:
      E.g. "E:\SyncDir" -> "\SyncDir"

    2. Save and copy synchronization settings to the USB stick: "E:\settings.ffs_gui"

    3. "Start FreeFileSync by double-clicking on "E:\settings.ffs_gui"
      => Working directory automatically is set to "      E:\" by the operating system so that "\SyncDir" is interpreted as "E:\SyncDir" during synchronization.


Volume Shadow Copy Service (Windows only)

FreeFileSync supports copying locked or shared files by creating a Volume Shadow Copy of the source drive. To enable this feature go to Menu -> Advanced -> Global settings: Copy locked files.

    Note:

    • This functionality is applied to locked files only. Regular files will not use Volume Shadow Copy Service when being synchronized.

    • Creating Volume Snapshots using VSS requires the application to be started with Administrator rights.

Troubleshooting

If you experience problems using the Volume Shadow Copy Service a renewal of registration might help. Create and execute a *.cmd batch file with the follow content or enter directly via commandline:

    cd /d %windir%\system32
    Net stop vss
    Net stop swprv
    regsvr32 ole32.dll
    regsvr32 oleaut32.dll
    regsvr32 vss_ps.dll
    Vssvc /register
    regsvr32 /i swprv.dll
    regsvr32 /i eventcls.dll
    regsvr32 es.dll
    regsvr32 stdprov.dll
    regsvr32 vssui.dll
    regsvr32 msxml.dll
    regsvr32 msxml3.dll
    regsvr32 msxml4.dll

(Reference: http://support.microsoft.com/kb/940032)