Files and Directories Synchronisation
nnbackup.exe sync -i c:\data -o d:\backup\data [options] nnbackup.exe sync2 -i c:\data -o d:\backup\data [options]
In directory synchronisation mode, nnBackup checks two specified directories to see if they are identical. If the input directory contains new or modified files, they will be copied to the output directory. If the output directory lacks some files that are present in the input directory, these files will be copied too.
The chief benefits of directory synchronisation mode as compared to other methods of backing up your data are as follows:
I would like to especially draw your attention to the fact that the use of the directory synchronisation mode is not limited to creation of backups: it can be useful when it is necessary to transfer some files from one computer to another or to synchronise some files within a workgroup.
Synchronisation can be onedirectional, where new and modified files are copied from the input directory to output directory (command sync) or bidirectional, where new and modified files are first copied from the input directory to output directory, and then from output directory to input directory (command sync2). Bidirectional synchronisation maybe useful in a situation where files can be modified in both directories.
Onedirectional synchronisation allows user to use an additional (optional) possibility to remove from the output directory those files that do not exist in the input directory (options -da, -delete-before) and even the files, that matches the exclusive filename mask -x (option -delete-excluded).
When synchronising directories, you can specify more that one input directory (option -i):
nnbackup.exe sync -i c:\data -i c:\another_data -o d:\backup\data -s -v
You can specify several input directories even when performing bidirectional synchronisation (sync2), but in this case make sure you used the command line option -p which creates in the output directory a directory structure matching full paths of files in the input directories. In this way, nnBackup will be able to know from which directory a certain file was taken:
nnbackup.exe sync2 -i c:\data -i c:\another_data -o d:\backup\data -p -s -v
Keep in mind that in sync/sync2 modes (as well as all the other modes) you can fine-tune the program's behavior by specifying what types of files should be processed (synchronised in this case). For example, you can use inclusive or exclusive filename masks (-m, -x), filters of the creation and/or last modification date (-D, -DC, -DW), file size filters (-LT, -GT) and file attributes filters (options -a, -ax). Note, that you can choose some files manually, put them into the output directory and specify, that you want to synchronise only these files (option -existing) or (on the contrary) synchronise all the files except the files that already exist in output directory (option -ignore-existing). There will be no synchronisation at all if you specify both these options at the same time (-existing -ignore-existing).
Sometimes after performing synchronisation you may want to revert to initial file version. Especially for this purpose there is an option -backup <dir_path>, which saves all the files, that were overwritten during synchronisation to the specified location:
nnbackup.exe sync -i c:\data -o d:\backup\data -s -v -backup c:\temp
Some of the command line options in nnBackup were expressly created for use in the files and directories synchronisation mode: more.
Please note that if you are using a slow network connection or synchronising a great number of files, the synchronisation process may require quite some time. When working on slow networks, you can try to divide the synchronisation process in two steps: first copy to the output directory all the files that has been changed (copy mode with options -D, -DC, -DW), and then delete all the files that are no longer present in the input directory (delabsent mode).
A special syntax for setting the input and output directories (-ip and -op) allows you to synchronise files between your PC and mobile devices, connected via ActiveSync (more info):
nnbackup.exe sync -i c:\books -op "\Documents\books\" -s -v
The -nocopy option will allow you to test the command line that you are going to use: nnBackup will imitate the process of directory synchronisation, but the files won't be actually copied or deleted:
nnbackup.exe sync -i c:\data -o d:\backup\data -s -ad -da -v -nocopy
Examples:
nnbackup.exe sync -i c:\data -o d:\backup\data -s -e -ad -v -log d:\log\nnbackup.log
Explanation: Synchronisation of directories c:\data and d:\backup\data. During the synchronisation, nnBackup will take in account all subdirectories in c:\data and display/write to log the full file paths. Empty directories will be copied. Information about the backup session will be saved to a log file in d:\log\nnbackup.log.
nnbackup.exe sync2 -i c:\data -o c:\another_data -s -e -ad -v -log d:\log\nnbackup.log
Explanation: Same as above, but synchronisation is bidirectional: first new and modified files will be copied from c:\data to c:\another_data and then in the opposite direction: from c:\another_data to c:\data
nnbackup.exe sync -i c:\data -o d:\backup\data -s -e -ad -da -v -log d:\log\nnbackup.log
Explanation: Synchronisation of directories c:\data and d:\backup\data. During the synchronisation, nnBackup will take in account all subdirectories in c:\data and display/write to log the full file paths while copying the files. All the files and directories which are not present in c:\data will be deleted from d:\backup\data. Information about the backup session will be saved to a log file in d:\log\nnbackup.log.
nnbackup.exe sync -i c:\data -o d:\backup\data -s -e -ad -tc -md5 -da -v -log d:\log\nnbackup.log
Explanation: Synchronisation of directories c:\data and d:\backup\data, taking in account file creation/modification times, file size and control sums. During the synchronisation, nnBackup will take in account all subdirectories in c:\data and display/write to log the full file paths while copying the files. All the files and directories which are not present in c:\data will be deleted from d:\backup\data. Information about the backup session will be saved to a log file in d:\log\nnbackup.log.
See also: