如何移动相对符号链接? [英] How do I move a relative symbolic link?

查看:117
本文介绍了如何移动相对符号链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多相对的符号链接,我想移到另一个目录.

I have a lot of relative symbolic links that I want to move to another directory.

如何在保留正确路径的同时移动符号链接(具有相对路径的链接)?

How can I move symbolic links (those with a relative path) while preserving the right path?

推荐答案

您可以使用readlink -f foo将相对路径转换为完整路径.所以你会做类似的事情:

You can turn relative paths into full paths using readlink -f foo. So you would do something like:

ln -s $(readlink -f $origlink) $newlink
rm $origlink

我注意到您希望保持相对路径.在这种情况下,移动链接后,可以使用symlinks -c将绝对路径转换回相对路径.

I noticed that you wish to keep the paths relative. In this case, after you move the link, you can use symlinks -c to convert the absolute paths back into relative paths.

这篇关于如何移动相对符号链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆