hsync
A filesystem hierarchy synchronizer
About
hsync SOURCE TARGET
renames files in TARGET so that identical files found in
SOURCE and TARGET have the same relative path.
The main goal of the program is to make folders synchronization faster by sparing big file transfers when a simple rename suffices. It complements other synchronization programs that lack this capability.
By default, files are not renamed and a preview is printed to standard output.
False positives can happen, e.g. if two different files in SOURCE and TARGET are the only ones of this size. Use the preview to spot false positives and make sure all files get renamed properly.
You can redirect the preview to a file. If you run the program using this preview file as SOURCE, the analysis will be skipped. This is useful if you want to tweak the result of the analysis.
Notes:
- Duplicate files in either folder are skipped.
- Only regular files are processed. In particular, empty folders and symbolic links are ignored.
Examples
hsync can easily be associated with rsync (or any synchronization for that matters) to speed up mirroring:
$ hsync -p /path/to/storage /path/to/mirror $ rsync -livr --size-only --delete-excluded /path/to/storage/ /path/to/mirror
hsync also has some interesting side uses.
Since hsync will display a warning on duplicates, it can be used to get the list of duplicates in a folder:
$ hsync /path/to/analyze /dev/null > ~/dups.log
If SOURCE is a JSON file with the following structure:
{ "oldpath1": "newpath1", "oldpath2": "newpath2", ... "oldpathN": "newpathN" }
hsync will rename files in TARGET accordingly. This JSON file can be generated by hand or dynamically from any other program. If generated from an hsync preview, TARGET needs not be the one used for previewing the renames. This is useful for complex renaming operations containing cycles (e.g.
a->b->c->a
) or chains (e.g.a->b->c->d
).
Installation
See the development page.
Usage
See hsync -h
.
License
See the LICENSE in the source code.
Links
- Development page (Please file reports there.)
- Implementation details
- Arch Linux package (AUR)