FileMirrorSync - A file mirror synchronization tool
FileMirrorSync is a simple one-way file synchronization tool (incremental file copy).
It may be used to maintain an identical copy of the files in a directory tree, e.g. as a backup copy.
The program compares the sizes and last modification times of the files in the source directory tree
against those in the target directory tree.
Then it updates the target directory tree by copying the different files,
and by deleting and renaming files and directories as necessary, to make the target identical to the source.
Features
- Open-Source.
- Written in Java. Requires Java 7 or newer.
- Based on the new java.nio.file package.
- Command-line interface (no GUI).
- Limitation: File attribute changes are not synchronized.
Download
Example
To copy (mirror-synchronize) the files from c:\myfiles to d:\mybackup:
java -Xmx500M -jar filemirrorsync.jar c:\myfiles d:\mybackup
(The "-Xmx" option is only necessary if you have very much files.
It's used to increase the maximum heap memory size of the Java VM (to 500 MBytes in the example).)
Command-line Syntax
Usage:
java -jar filemirrorsync.jar [options] sourcePath targetPath
Parameters:
sourcePath
Path of the source directory or source file
targetPath
Path of the target directory
Options:
-l
-listOnly
Only list the file and directory differences, without copying or changing anything.
-ignoreCase
-noIgnoreCase
Specifies whether case should be ignored when associating source
file/directory names with target file/directory names.
This is automatically done when one or both of the file systems
are case-insensitive.
Default is -noIgnoreCase
.
-renameCase
-noRenameCase
Specifies whether file/directory names should be renamed when the names of
the source and target files/directories only differ in case.
Default is -renameCase
.
-timeTolerance milliSeconds
Tolerance in milliseconds for comparing the last modified time of files.
This should be set to 1999 (nearly 2 seconds) when mirroring files to a FAT
file systems from a non-FAT file system, because the FAT file system only
has a 2 seconds resolution.
Default is 1999
.
-summerTimeTolerance
-noSummerTimeTolerance
Specifies whether time offsets of +/- 1 hour should be ignored.
Offsets of +/- 1 hour may occur when one copy of the files is stored on a
file system that uses UTC time (e.g. NTFS), and the other version on a
file system that uses local time (e.g. FAT).
Default is -summerTimeTolerance
.
-ignoreSystemHiddenFiles
-noIgnoreSystemHiddenFiles
Specifies whether files and directories that have both the system and the
hidden attributes set should be ignored. When enabled, files and
directories with these attributes are ignored in the source and in the
target directory trees.
Default is -ignoreSystemHiddenFiles
.
-v verbosityLevel
-verbosity verbosityLevel
Verbosity level between 0 and 9.
Default is 5
.
-debugLevel debugLevel
Debug level between 0 and 9.
Default is 0
Codes used in the output
A | add to target | source exists, target does not exist |
M | modify target | source and target exist but are different |
R | rename target | source and target exist and are equal, but file name upper/lower case characters differ |
D | delete from target | source does not exist, target exists |
Author: Christian d'Heureuse (www.source-code.biz, www.inventec.ch/chdh)
Index