This should show you all the local drives.... (minus CDs)  :)  Drive E:
is a USB Flash drive in my output below

HTH
 
use Win32::OLE;
 
$objWMIService = Win32::OLE->GetObject("winmgmts://./root/cimv2");
 
$colDisks = $objWMIService->ExecQuery("Select * from Win32_LogicalDisk
where ProviderName IS NULL and FileSystem IS NOT NULL and FileSystem <>
'CDFS'");

foreach $objDisk (in $colDisks) {
    print "DeviceID: " . $objDisk->{DeviceID}."\n";  
    print "File System: " . $objDisk->{FileSystem}."\n";
}

Output:
--------
C:\perl\scripts>perl wmi-logicaldisk.pl
DeviceID: C:
File System: NTFS
DeviceID: E:
File System: FAT32
________________________________

From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Daniel Burgaud
Sent: Tuesday, March 13, 2012 3:53 PM
To: Perl-Win32-Users
Subject: directory listing of "Computer" on win32


Hi All,

I am clueless how to do a directory list starting at the very root
"Computer" which includes all drives.

What I am doing to get a directory tree is this:
my $directory = "";
    opendir DIR, $directory;
    my @files = readdir DIR;
    closedir DIR;

But it only start at one drive - not all drives. I am missing out on
where to start the initial directory.

My main goal is to get all the drives on my computer, so I can do a
directory tree on those drives.


Thanks

Dan

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to