Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Converting absolut symlinks to relative ones...?



On Sun, Mar 06, 2016 at 02:20:13PM +0100, Meino.Cramer@xxxxxx wrote:

> Hi,
> 
> following "problem":
> 
> At some point in a directory tree there is a file (the reference), 
> which is physically copied multiple times into that
> tree below that point at different nesting depths.
> 
> I want to create a script which will find those files
> (already done) and replace those files with a symlink to the
> reference file.
> 
> Since I dont know of a simple way to calculate the "difference"
> of two absolute paths to create a relative path to the reference from the point of
> view of its current copy, I came across the idea to create symlinks
> with absolute paths to the reference in a first step and hope that there is a
> zsh/system/linux utility which will create relative symlinks afterwards...
> 
> This idea has one drawback: I dont know of such an utility... ;)

GNU ln has a -r option which does this.

Danek



Messages sorted by: Reverse Date, Date, Thread, Author