On Mon, 11 Jun 2007, János Gonzales wrote:
> I was wondering how and if perl can read file Title, Subject, Author,
> Category, Keywords and Comments on files in windows.
>
> If you right click on any file in windows and pick properties >
> summary, these fields are available for you to edit. How can perl
> read these?

Assuming Windows 2000 or later you can do this with the Shell.Application
objects:

  use strict;
  use warnings;
  use Win32::OLE;

  # print author of "c:\\tmp\\book.xls";

  my $shell  = Win32::OLE->new("Shell.Application") or die;
  my $folder = $shell->NameSpace("c:\\tmp") or die;
  my $file   = $folder->ParseName("book.xls") or die;

  print $folder->GetDetailsOf($file, 9);

You can get the index for the various metadata fields from this article:

http://www.microsoft.com/technet/scriptcenter/guide/sas_fil_lunl.mspx?mfr=true

Cheers,
-Jan

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to