Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
想象一下这是我的文件夹结构
filepath\targetpath filepath\folder1
当我在 targetpath 文件夹中时,我可以创建符号链接
ln -s ..\folder1 folder2
但是当我尝试使用以下命令从上层创建符号链接时
ln -s filepath\folder1 filepath\targetpath\folder2
它创建快捷方式文件而不是文件路径的符号链接。
当我在 targetpath 文件夹之外时如何创建符号链接?
如果符号链接不是绝对路径名(以 开头/),它将相对于包含链接的目录进行解释,而不是相对于您创建链接时的 cwd。所以如果你这样做:
/
ln -s filepath/folder1 filepath/targetpath/folder2
链接的目标是filepath/targetpath/filepath/folder1. 您应该以与第一次相同的方式制作符号链接:
filepath/targetpath/filepath/folder1
ln -s ../folder1 filepath/targetpath/folder2