我在文件大小和已用磁盘空间之间存在差异(总文件大小甚至超过磁盘大小)。我想是因为 Windows 7/Vista 中存在许多硬链接(hard link)(到 WinSxS 组件)。但是在 Windows 7 中如何以编程方式区分硬链接(hard link)和真实文件?
最佳答案
你不能,因为所有文件都是硬链接(hard link)。不完全是。文件只是指向数据 block 的硬链接(hard link)——目录中的列表。 (也许你的意思是符号链接(symbolic link)?你可以区分它们...)
改为使用 Windows 提供的内置方法来计算已用空间。
编辑:Reference (强调我的)
The link itself is only a directory entry, and does not have a security descriptor. Therefore, when you change the security descriptor of a hard link, you a change the security descriptor of the underlying file, and all hard links that point to the file allow the newly specified access.
关于c++ - 如何以编程方式区分 Windows 7 中的硬链接(hard link)和真实文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3636820/