Find all files over a certain size (Perl)

This code can be found in Chapter 7 of Windows XP Cookbook

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the Perl code from this site.

# From the book, "Windows XP Cookbook"
# ISBN: 0596007256

# ------ SCRIPT CONFIGURATION ------

use Win32::OLE qw(in);

$strComputer = '<ComputerName>';
$intSizeBytes = 1024 * 1024 * 500;
# = 500 MB
# ------ END CONFIGURATION ---------
$objWMI = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\cimv2');
$colFiles = $objWMI->ExecQuery('Select * from CIM_DataFile where FileSize > \'' . $intSizeBytes . '\'');
foreach my $objFile (in $colFiles) {
    print $objFile->Name . ' ' . $objFile->Filesize / 1024 / 1024 . 'MB', "\n";
}

This code has been viewed 1088 times.

New from the creators of TechTasks.com: StatSheet.com