且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Linux上将常规文件转换为符号链接

更新时间:2023-11-11 23:18:52

我不相信Linux中有您所描述的方法. IIRC,文件系统将符号链接信息存储在inode表中,而不是常规文件中,因此没有直接的方法将文件转换为链接.

I don't believe there is a way in Linux to do this as you describe. IIRC, the filesystem stores symlink information in the inode table and not in a regular file so there's no direct way of turning a file into a link.

如果符号链接的路径存储在文件内,为什么不读出路径,删除文件并在其位置创建符号链接?

If the symlink's path is stored inside the file, why not read out the path, delete the file, and create a symlink in its place?