From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7461 invoked by alias); 6 Mar 2016 17:48:07 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21364 Received: (qmail 21281 invoked from network); 6 Mar 2016 17:48:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 Date: Sun, 6 Mar 2016 09:39:15 -0800 From: Danek Duvall To: Meino.Cramer@gmx.de Cc: zsh-users@zsh.org Subject: Re: Converting absolut symlinks to relative ones...? Message-ID: <20160306173915.GC10755@lorien.comfychair.org> Mail-Followup-To: Danek Duvall , Meino.Cramer@gmx.de, zsh-users@zsh.org References: <20160306132013.GA4938@solfire> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160306132013.GA4938@solfire> User-Agent: Mutt/1.5.20 (2010-04-22) On Sun, Mar 06, 2016 at 02:20:13PM +0100, Meino.Cramer@gmx.de 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