Does Windows support metadata for every file?
I know things like 开发者_JAVA技巧images, music, videos support metadata. My idea is that I want to write a download manager that adds info to the files I download: the URL I downloaded it from, the date and time I downloaded it, possibly some more. For this to work I need to add info for more than just photos and videos. I could just save a hidden .XML flie, but if Windows supports this already then it would be better.
There is a thing called an "Alternate Data Stream" which NTFS supprorts for any file. I'm not really sure what it's meant to be used for though.
The metadata that you see in JPG's (exif properties), MP3s (ID3 Tags) and whatnot are all proprietary to each file format, and Windows simply knows how to read those properties. Same goes for Modifed/Created/Accessed dates. There is no one method of storing this data.
NTFS supports metadata, I've never thought about how to access it beyond what you can do by right-clicking on a file, clicking Properties and then Summary. You can edit existing metadata by clicking on the Value column.
There's a question on StackOverflow that's similar: How do you retrieve image tags From one of the answers there, there's a link to MSDN with more details of the Vista (and XP) Property System.
In your case you should definitely use the NTFS alternate data streams as the information you want to attach would otherwise have to be supported by the downloaded file's format and you want to add this information to any file type.
Although you have to remember that information hidden in those streams may be lost when the file holding it is transferred over the network, to a non-NTFS flash drive or any other non-NTFS medium.
精彩评论