每个文件或文件夹NTFS中的唯一信息 [英] unique information in each file or folder NTFS

查看:51
本文介绍了每个文件或文件夹NTFS中的唯一信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个项目中工作,我需要从服务器中填充一些文件,并在Webrowser中向用户显示它们.允许用户对文件执行基本CRUD操作的位置问题在于,我无法将文件/文件夹的名称指定为唯一ID ,如果用户删除/重命名文件,我需要该名称,以后我应该能够识别该文件.

我的问题是, NTFS 中的任何文件/文件夹是否都具有唯一性并且可以使用?以及如何使用 .NET c#访问该信息.

遍历 BY_HANDLE_FILE_INFORMATION结构但这可能需要我 pinvoke .

更新1 -尝试查看使用nFileIndexHigh和nFileIndexLow的可行性,但他们需要我进行一次点名操作,并且此方法不能与文件夹一起使用他们提到文件夹时的一个链接唯一文件夹标识符告诉我,这是不可能的.

解决方案

不管您似乎不想P/调用其他方法,都可以使用 Desktop 位于层次结构的根部,即使它实际上是磁盘上某个子文件夹.

im working on a project where in i need to populate some files from the server and show them in a webrowser to the user. Where user would be allowed to do basic CRUD operation on the file The problem is that i cannot assign the name of the file/folder as unique id which i need in case a user deletes/renames a file i should be able to identify the file later.

My question is that is there anything unique about any file/folder in NTFS that is unique about them and that can be used? and how that information can be accessed using .NET c#.

Came across the BY_HANDLE_FILE_INFORMATION structure but it probably needs me to pinvoke.

UPDATE 1 - tried looking at the feasibility to use nFileIndexHigh and nFileIndexLow but they would need me to do a pinvoke and also this method cannot be used with folders one link when they mention folders Unique Folder Identifier tells me that it isnt possible.

解决方案

Disregarding the fact that it seems that you don't want to P/Invoke a different approach could be to use the Windows Shell API. This API has the concept of a PIDL which identifies a folder (or "similar" item) in the shell namespace. A PIDL does not change even if the user renames the folder. The drawback is that the Shell API exposes what you see in Windows Explorer, e.g. Desktop is at the root of the hierarchy even though it physically is subfolder somewhere on a disk.

这篇关于每个文件或文件夹NTFS中的唯一信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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