Tool to automatically update symlinks when moving files

Michael ODonnell michael.odonnell at comcast.net
Wed Jul 1 16:26:47 EDT 2009



>> Does anyone know of a tool that can automatically update symbolic
>> links when moving files around on a filesystem, so as to maintain
>> symlink consistency?
>
>rsync has options to deal with symbolic links (and hard links) however
>you'd like it to

I think the complication he's dealing with is that he's not just
moving self-contained (sub-)hierarchies around, which is something
(as you say) that rsync handles trivially; even the humble "mv"
and "cp -a" commands can often meet the need in those situations.

His problem is that he's moving relative symlinks (or their
referents) around such that the symlinks no longer point at the
right thing and he wants something that detects that and recreates
those symlinks such that they still point at the right things when
the dust has settled.

So he wants something that (say) generates a list of symlinks and
referents prior to the move and then goes through and does the fixups
afterwards.  Of course, while it's easy to see when you've moved
a symlink it's much more tedious to detect when something you've
moved is the *referent* of a symlink - AFAIK only an exhaustive
search could reveal that.



More information about the gnhlug-discuss mailing list