检测符号链接,交接点,安装点和硬链接 [英] Detect Symbolic Links, Junction Points, Mount Points and Hard Links

查看:324
本文介绍了检测符号链接,交接点,安装点和硬链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有人知道如何检查,如果一个文件或目录可以是一个符号链接 结点 挂载点硬链接

does anyone know how to check if a file or directory is either a Symbolic Link, Junction Point, Mount Point or Hard Link?

据我知道一个符号链接是通过检查它的ReparsePoint属性的文件进行检测。 结点通过检查ReparsePoint属性的目录检测。因此,如果ReparsePoint属性被设置在一个文件时,它必须是一个符号链接,否则,如果它在一个目录设置它只能是一个结点,对吧?

As far as I know a symbolic links are detected by checking a file for its "ReparsePoint" attribute. Junction points are detected by checking a directory for the "ReparsePoint" attribute. So if the "ReparsePoint" attribute is set on a file it must be a symbolic link, otherwise if it's set on a directory it can only be a junction point...right?

好为止,但我还是不知道如何检测挂载点和硬链接。 谁能告诉我如何做到这一点?

Good so far, but I have still no idea how to detect "Mount Points" and "Hard Links". Can anyone tell me how to do this?

推荐答案

符号链接,交接点,并挂载点是不同的重分析点的例子。硬链接,然而,仅仅是普通文件。在NTFS中的所有文件都是硬链接。您可以检测到一个文件有多个硬链接指向它,但没有真正的文件,它指向。你可以把硬连接的只是不同的名称相同的文件。

Symbolic Links, Junction Points, and Mount Points are all examples of different reparse points. Hard Links, however, are just regular files. On NTFS all files are hard links. You can detect that a file has multiple hard links pointing to it, but there's no "real file" that it points to. You can think of hard links as just different names for the same file.

下面是从C#访问重解析点的一些信息:<一href="http://www.$c$cproject.com/KB/vista/ReparsePointID.aspx?display=Print">http://www.$c$cproject.com/KB/vista/ReparsePointID.aspx?display=Print

Here's some information on accessing reparse points from C#: http://www.codeproject.com/KB/vista/ReparsePointID.aspx?display=Print

下面是关于如何做到这一点在C中的一些信息: http://blog.kalmbach-software.de/2008 / 02 /

Here's some information on how to do it in C: http://blog.kalmbach-software.de/2008/02/

这篇关于检测符号链接,交接点,安装点和硬链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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