ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activeperl
activeperl
Accessing Extended File Attributes - Word Document
by Tim Moor other posts by this author
Oct 30 2009 4:24PM messages near this date
RE: Help with PerlApp | RE: Accessing Extended File Attributes - Word Document
Hi there, I have around 50,000 or so word documents and I would like to
write a script to sort these files by author. The author is held as a
extended file attribute and so far I have not been able to find a way to
access this data. I have tried using the following Win32::OLE script to
extract these values. However under Windows 7 this does not return the
correct information. I am unsure wither this is because Windows 7 has
changed the file attribute structure, or because this method does not allow
me access to this data.

my $directory = $ARGV[0] || die "$pname requires directory as first
ar+gument\n";

find(\&main2, $directory);

sub main2{
    if(-f $File::Find::name){
        if(extention($File::Find::name) eq '.pdf'){
            #print "File: $_ Extention: " . extention($_) . "\n";
            my $shell  = Win32::OLE-> new("Shell.Application") or die;
            my $folder = $shell-> NameSpace("$File::Find::dir") or die;
            my $file   = $folder-> ParseName("$_") or die;
            for my $i (0..50){
                my $attrib = $folder-> GetDetailsOf($file, $i);
                print "$i) $_ > > $attrib\n" if ! $attrib eq '';
            }
            print "-------------------------------------------\n";
        }
    }
}

[download] <http://www.perlmonks.org/index.pl?abspart=1;displaytype=displaycode;node_id=8042
37;part=1> 

I want to be able to access this value on pdf, doc & excel files types so if
you could point me in the direction of a module or thread on how I can
achieve this I would be forever grateful. Thanks and looking forward to your
response. Tim


-- 
Thanks,

Tim
Thread:
Tim Moor
Jan Dubois

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved