Windows Log file compression in perl

This script will search the location for all .log files and compress them using NTFS.

#!perl
#Search osbLocations for *.log files and ntfs compress them.

use File::Find;
use Win32::OLE;

@osbLocations = (
  'E:/obs-win-mthosting2',
  'E:/obsr-win-mthosting3',
  );

$strComputer = '.';
$objWMI = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\cimv2');


foreach (@osbLocations) 
{
 find(\&processFile, $_);
} 


sub processFile()
{
 if ( -f and /.log$/ )
 {
  $objFile = $objWMI->Get('Cim_Datafile=\'' . $File::Find::name . '\'');
  if ($objFile->Compressed != 1)
  {
   print $objFile->Name, "\n";
   $intRC = $objFile->Compress;
   # To uncompress change this to objFile.Uncompress
   if ($intRC != 0) {
       print 'There was an error compressing the file: ' . $intRC, "\n";
   }
   else {
       print "File compression successful\n";
   }
  }
 }
}

Cross-Platform Message Box

I needed a cross-platform message box for Windows and Mac. I tried wxperl because its native on the mac but their is a bug with their MessageBox code on the mac.

This is pretty simple code, but uses each O/S’s native message box API to display a dialog. If you have Yes/No buttons and click yes it will perform the item in action. Which for us opens a webpage. You only need a standard perl installation for this code.


WHS Bliss

I just finished upgrading my DNS-323 NAS to a Acer H340 Windows Home Server NAS.

I am also running Ahsay Off-Site backup software on the unit to backup my Macintosh laptops and a couple of friends computer.

So far no complaints. The media streaming to the Xbox 360 is great also.