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";
}
}
}
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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.