[python-win32] get file tags in windows7 vista

Roger Upole rupole at hotmail.com
Sun Dec 12 23:40:33 CET 2010


nonino wrote:
>
> Ok, Lets start from the beginning:
> I am doing a PhD in information science. As part of my study I am studying
> the use of folders vs. tags. starting from windows vista there is an 
> option
> in windows to add tags to office files photos and other file formats. In 
> the
> first part of my experience I will run on the participant's computer a
> program (the one that I am trying to write:)) that return the ouput: 1000
> files in total: 100 in under folder hierarchy of 4, 300 under folder
> hierarchy of 3 600 under folder hierarchy of 2. (I wrote this program with
> os.walk) then I will teach the participants how to use the tag options and
> will ask them to tag their files for the next 2 weeks.
> After two weeks I would like to run again the program and now to see how
> many tags were added. so the output will be for example: 1010 files in
> total: 105 in under folder hierarchy of 4, 305 under folder hierarchy of 3
> 600 under folder hierarchy of 2. 7 files with 3 tags 3 files with 2 tags 
> 10
> files with 1 tag.
> So, please help me. how can I get those tags out of the files?
>

The low-level Property System interfaces introduced in Vista haven't been
wrapped in Pywin32 yet.  However, you can use the higher level shell objects
to retrieve any column that can be displayed in Explorer.
As a starting point, here's a script that uses the shell objects.

http://web.archive.org/web/20070228173702/www.uselesspython.com/download.php?script_id=124

      Roger





More information about the python-win32 mailing list