[Liverpool] batch-edit symlinks
Neil Bothwick
neil at stfw.net
Fri Mar 2 21:07:49 GMT 2007
On Fri, 2 Mar 2007 20:24:32 +0000, Daniel Hulme wrote:
> To put it another way, I have a directory whose subdirectories contain
> symlinks all pointing to files under some second directory. For each of
> those symlinks, I want to replace the absolute path to that second
> directory with the path to a third directory. I want it to take less
> than o(n) effort on my part.
Something like this should work, but I haven't tested it
find /some/path -type l | while read LINK; do
TARGET=$(readlink $LINK)
ln -sf "${LINK/old\/dir/new\/dir/}" "$TARGET"
done
--
Neil Bothwick
Seduced by the Chocolate side of the Force...
More information about the Liverpool
mailing list