Syncdir is a utility to synchronize the contents of two directories. Depending on the file time stamps files are copied either from the left directory to the right directory or the right directory to the left directory. A text database .syncdir is maintained with all existing files. I a file exists in one directory and not in the other, it is deleted if it did exist before, or copied it it did not exist before.
Syncdir is typically used to keep the contents of two directories synchronized when one can be working with the files in both directories. E.g. one has a documents directory on a file server (that is backed- up hourly/daily by the IT department) on which one is working while in the office. On ones laptop there is a copy of this directory on which one works when one is away from the office. One has to run syncdir just before one leaves the office and just after one arrives back in the office.
Usage: syncdir [-a] leftdir rightdir
Normally syndir does not copy/delete hidden files or files starting with a dot. If the -a option is provided these files are copied/deleted as well.
Bakdir is a utility sharing part of the code base of syncdir. It copies files from the source directory to the target directory if files in the source directory have a different time stamp or are not existing in the target directory. If files do not exist in the source directory but do exist in the target directory they are deleted from the target direcory.
Bakdir is typically used to regulary backup the contents of a ducoments directory on ones computer to a USB drive. It is very fast since it leaves files that exist in both the source and the target diectory and have the same file time stamp untouched.
Usage: bakcdir [-a] [-d] leftdir rightdir
Normally bakdir does not copy/delete hidden files or files starting with a dot. If the -a option is provided these files are copied/deleted as well. Delete operations are only done if the -d option is provided.
Replaceidir is a utility sharing part of the code base of bakdir. The difference is that is does not copy files that are not yet existing in the target dir.
Replacedir is typically used if one has copied a selection of files from ones document dir to a USB drive. E.g. when one needs these files on someone elses computer for a presentation. With replacedir these files but these files only can be updated if the original files in ones document directory have been updated. It does not add new files to the target directory.
Usage: replacecdir [-a] [-d] leftdir rightdir
Normally replacedir does not copy/delete hidden files or files starting with a dot. If the -a option is provided these files are copied/deleted as well. Delete operations are only done if the -d options is provided.
Seperate versions for Unix/Linux and Windows are provided. The low level code in these versions differs because Unix/Linux and Windows use different system calls to access the file system. Compiling the Unix/Linux code for Windows would be possible but results in much more disk access and so slower operation.
A Perl version is provided as well. Note that Perl is an interpreted language. Expect much slower operation from the Perl version than from the compiles Unix/Linux or Windows versions.
Download the syncdir, bakdir and replacedir utilities, including the source code.
For the copyright of the provided Cygwin utilities see https://www.cygwin.com/.
Syncdir, bakdir and replacedir are free to copy and use on your own risk. They come without warrenty.
Home | fwiarda@fwiarda.com |