473,385 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Accessing Windows file metadata?

EP
I'm looking for a method by which to access Windows files metadata and
have not been able to find anything in the standard modules or via
Google - what is the standard approach?

Shamefully I really do not understand Windows file system - e.g. is
properties metadata attached to the file? if I change that metadata
do I change the file's hash? how is the metadata structured? or is
the "properties" metadata simply derived upon access?

Either way, is there a module or method to access this metadata (I'd
hope there was a metadata dictionary for each file, but that may be a
sign I've been spoiled by Python) ?
EP

Jan 11 '06 #1
2 8722
The Pywin32 package wraps the interfaces used to read and
write these properties. \win32com\test\testStorage.py demonstrates
how to use them.

There are actually two different ways that metadata is stored.
For structured storage files created by COM applications, it's
embedded directly in the file data. This would change the file's hash
if the document properties were changed. On volumes formatted
with NTFS 5 (Win2k and later), document properties can be added
to any type of file and are stored in alternate data streams.

hth
Roger

"EP" <er***********@gmail.com> wrote in message news:11**********************@o13g2000cwo.googlegr oups.com...
I'm looking for a method by which to access Windows files metadata and
have not been able to find anything in the standard modules or via
Google - what is the standard approach?

Shamefully I really do not understand Windows file system - e.g. is
properties metadata attached to the file? if I change that metadata
do I change the file's hash? how is the metadata structured? or is
the "properties" metadata simply derived upon access?

Either way, is there a module or method to access this metadata (I'd
hope there was a metadata dictionary for each file, but that may be a
sign I've been spoiled by Python) ?
EP



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jan 12 '06 #2

Probably somebody more deeply into this will soon give you a better answer,
but I'll
try to give a better-than-nothing answer.

The Properties metadata that you see in the shell can come from several places.
The oldest, commonest source is from Microsoft Office files. These have a
compound
structure associated with OLE Object Linking and Embedding and the metadata
is just one
of a lot of things stuck in there besides the Word text or Excel numbers
you see in the
application.

Getting to it from Python is via COM. See Mark Hammond and Andy Robinson's
book
"Python Programming in Win32" for the general approach. Perhaps the easiest
way to
get this metadata is using DSOFILE.DLL that was released as an example a long
time ago by Microsoft (it's not an OS file, you have to install it yourself).
The following article gives a VBScript example that you can
use as a template for your Python.

http://www.microsoft.com/technet/com...ts/sg0305.mspx

As I said, the OLE metadata has been around for a long time. With Windows
2000, MS
extended the idea to any NTFS file so that you have an open-ended ability to
associate named attributes like author, title, keywords or custom attributes
of your
own to any file on an NTFS partition.

Unfortunately DSOFILE does not help with this (at least I don't think so!),
so you'd need
to deal with the OS at a somewhat uglier level. And obviously you need Win2K
or better.

Look at \win32com\test\testStorage.py in the win32 python package for an
example.

Hope this helps,
John Rhoads

I'm looking for a method by which to access Windows files metadata and
have not been able to find anything in the standard modules or via
Google - what is the standard approach?

Shamefully I really do not understand Windows file system - e.g. is
properties metadata attached to the file? if I change that metadata
do I change the file's hash? how is the metadata structured? or is
the "properties" metadata simply derived upon access?

Either way, is there a module or method to access this metadata (I'd
hope there was a metadata dictionary for each file, but that may be a
sign I've been spoiled by Python) ?

EP

Jan 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Denrael | last post by:
I am looking for a way in Python to update Windows File Summary Metadata. By that I mean the data (Title, Subject, Keywords, Comments) found when you right click a windows file, select properties...
17
by: Paul Rubin | last post by:
Dumb question from a Windows ignoramus: I find myself needing to write a Python app (call it myapp.py) that uses tkinter, which as it happens has to be used under (ugh) Windows. That's Windows...
0
by: Nathan Kovac | last post by:
I am stumped once again. Perhaps Nicholas or someone will be able to help me solve this issue. For background you can see my earlier post about timers and windows servcice. That issue was...
6
by: Nathan Kovac | last post by:
Yesterday afternoon I was getting the following errors in a windows service: 'DatabaseManager.DataComponent', 'Error', '3 Errors: Line: 0 - Metadata file 'ScriptingMethods.dll' could not be found...
1
by: Miku | last post by:
Hi Guies, I am new to vb.net. In my project I am using vb.net & MySql 4.0.17 as a backend. For database connectivity i have downloaded ByteFX - Mysql .net native provider. I have written the...
4
by: Jeffrey Barish | last post by:
Is there a way to interact with Windows Media Player from Python? I would like to be able to do things like tell WMP to play a given sound file or to ask WMP for metadata about a sound file. --...
3
by: jreljac | last post by:
Howdy, Is it possible (and if it is how?) to have php display the details of a word/excel/pdf document's properties/metadata? I can go into MS Word...File...Properties and assign things like...
2
by: wileyregister22 | last post by:
When rightclicking a, for example, pdf file on windows, one normally gets a screen with three or four tags. Clicking on one of the summary tag one can get some info like "title", "Author",...
5
by: Luis Zarrabeitia | last post by:
I need to parse a file, text file. The format is something like that: TYPE1 metadata data line 1 data line 2 .... data line N TYPE2 metadata data line 1 ....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.