Display properties and attributes of a folder (Perl)

This code can be found in Chapter 8 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;

$strDirPath = 'c:\\\\scripts';
$strComputer = '.';
# ------ END CONFIGURATION ---------

$objWMI = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\cimv2');
$objFile = $objWMI->Get('Win32_Directory="' . $strDirPath . '"');
print $objFile->Name, "\n";

print ' 8.3 Name: ' . $objFile->EightDotThreeFileName, "\n";
print ' Drive: ' . $objFile->Drive, "\n";
print ' Folder Name: ' . $objFile->FileName, "\n";
print ' File Type: ' . $objFile->FileType, "\n";
print ' Path: ' . $objFile->Path, "\n";
print ' InUse Counter: ' . $objFile->InUseCount, "\n";

print ' Creation Date: ' . $objFile->CreationDate, "\n";
print ' Last Accessed: ' . $objFile->LastAccessed, "\n";
print ' Last Modified: ' . $objFile->LastModified, "\n";

print ' Archive: ' . $objFile->Archive, "\n";
print ' Compressed: ' . $objFile->Compressed, "\n";
print ' Encrypted: ' . $objFile->Encrypted, "\n";
print ' System: ' . $objFile->System, "\n";
print ' Writeable: ' . $objFile->Writeable, "\n";
print ' Hidden: ' . $objFile->Hidden, "\n";

This code has been viewed 1087 times.

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