#! c:/perl/bin/perl.exe -slw
$|++;
AUTOLOAD;
require 5.008;
use strict;
use warnings 'all';
use Win32;
use Win32::OLE;
my $fso = Win32::OLE->new( 'Scripting.FileSystemObject' );
Win32::OLE->Option( Warn => 0 );
my $file = $fso->GetFile("c:\\perl\\bin\\perl.exe");
for my $key (keys %{$file})
{
print "$key : $file->{$key}\n";
}
####
C:\Perl\FSO>archive.pl
Path : C:\Perl\bin\perl.exe
Name : perl.exe
ShortPath : C:\perl\bin\perl.exe
ShortName : perl.exe
Drive : Win32::OLE=HASH(0x1a4a3d0)
ParentFolder : Win32::OLE=HASH(0x1a4a3ac)
Attributes : 32
DateCreated : Win32::OLE::Variant=SCALAR(0x1a4a3dc)
DateLastModified : Win32::OLE::Variant=SCALAR(0x1a4a358)
DateLastAccessed : Win32::OLE::Variant=SCALAR(0x1a4a40c)
Size : 41033
Type : Application
C:\Perl\FSO>
####
use Win32::OLE::Variant;
####
#! c:/perl/bin/perl.exe -slw
$|++;
AUTOLOAD;
require 5.008;
use strict;
use warnings 'all';
use Win32;
use Win32::OLE;
use Win32::OLE::Variant;
my $fso = Win32::OLE->new( 'Scripting.FileSystemObject' );
Win32::OLE->Option( Warn => 0 );
my $file = $fso->GetFile("c:\\perl\\bin\\perl.exe");
for my $key (keys %{$file})
{
if ( $key eq 'Drive')
{
for (keys %{$key->{'Drive'}})
{
print "$_ \n";
}
}
elsif ($key eq 'ParentFolder')
{
for (keys %{$key->{ParentFolder}})
{
print "$_ \n";
}
}
else
{
print "$key : $file->{$key}\n";
}
}
####
C:\Perl\FSO>archive.pl
Path : C:\Perl\bin\perl.exe
Name : perl.exe
ShortPath : C:\perl\bin\perl.exe
ShortName : perl.exe
Can't use string ("Drive") as a HASH ref while "strict refs" in use at C:\Perl\F
SO\archive.pl line 22.
C:\Perl\FSO>