Description: | A tool that synchronizes hierarchies of symlinks. |
Latest Version: | 2017.8 |
Source Code: | src/ |
Architecture: |
|
Dependencies: |
|
Arch Repositories: |
|
AUR Page: | synclinks |
Arch Forum Thread: | 137161 |
Tags: |
synclinks
is a tool for synchronizing a hierarchy of
symlinks. It’s a bit like a limited version of rsync that creates
synclinks instead of copying the files.
synclinks foo bar
This will traverse the directory “foo” and create a symlink at the same relative path in “bar” for every file that it finds. For example, given “foo” with
foo/bar.txt
foo/baz/whatever.txt
synlinks will create
bar/bar.txt -> foo/bar.txt
bar/baz/whatever.txt -> foo/baz/whatever.txt
synclinks -u foo bar
The update option will make synclinks traverse “bar” first and copy any files in bar to “foo”. It will then continue as above. This ensures that any files created in “bar” (i.e. completely new files or replaced symlinks) will be moved to “foo”, so that “foo” continues to contain all of the real files.
File lists are where the real functionality of synclinks lies. A file list is a plaintext file with a relative path on each line, for example:
a.txt
b.txt
d.txt
img
Running
synclinks -f /path/to/file foo bar
would then create
bar/a.txt -> foo/a.txt
bar/b.txt -> foo/b.txt
bar/d.txt -> foo/d.txt
bar/img -> foo/img
In this case, if “foo” contains e.g. c.txt
, it will not
be symlinked in “bar”. This allows you to expose a subset of the files
in “foo”. Furthermore, the paths in the file list may be directories
(e.g. “img” in this case) and they do not need to exist when synlinks is
run.1
Including the upgrade option when using a file list will move both files and directories back to the source directory.
I wrote this as part of a solution to manage clutter in my home directory. Some applications create files that I want to keep but most just clutter up my home directory with crap. With synclinks, I can keep the files that I want in a given location and then use filelists to symlink those into a temporary home directory in which I run applications. When I’m done, I use the update option to copy back any changes in my chosen files to the source files that I have in a different directory. After that I can just discard the entire temporary home directory.
I’m sure that there are other uses for this though.
-a
, has been added to emulate the
previous behavior.