in reply to Re: Re: Windows Scriptin Host & OLE.
in thread Windows Scriptin Host & OLE.
Aaaaouch, Lost a point and that really hurts...Well losing points here on PerlMonks is helping me to be less lazy...AUTOLOAD; require 5.006; $|++; use strict; use warnings 'all'; use diagnostics; use Win32::OLE qw[in]; my $fso = Win32::OLE->new( 'Scripting.FileSystemObject' ); my @folders = $fso->GetFolder( $ARGV[0] ); my $fCount =0; my $sCount =0; while( @folders ) { my $folder = pop @folders; $fCount += $folder->Files->Count; $sCount += $folder->SubFolders->Count; for my $subFolder ( in $folder->SubFolders ) { $fCount += $subFolder->Files->Count; push @folders, $_ for in $subFolder->SubFolders ; $sCount += $subFolder->SubFolders->Count; } } print "Files : $fCount, folders : $sCount\n";
|
|---|