Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Error with GetDRIVE() when using a mapped drive

by soonix (Canon)
on Nov 04, 2014 at 08:43 UTC ( [id://1105993]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Error with GetDRIVE() when using a mapped drive
in thread Error with GetDRIVE() when using a mapped drive

Ah, that's probably what Padre does, then. Thanks ;)
  • Comment on Re^3: Error with GetDRIVE() when using a mapped drive

Replies are listed 'Best First'.
Re^4: Error with GetDRIVE() when using a mapped drive
by vanz (Initiate) on Nov 04, 2014 at 18:27 UTC
    Aha!, Thanks a lot. I noticed too and I changed it. Here is the code
    #!perl use warnings; use strict; use Win32::OLE; my $fs = Win32::OLE->CreateObject('Scripting.FileSystemObject'); my $d = $fs->GetDrive('Y:') or die "GetDrive failed $!"; my $TotalSize = $d->{TotalSize}; my $FreeSpace = $d->{FreeSpace}; my $usedSpace = $d->{TotalSize} -= $d->{FreeSpace}; my $AvailableSpace = $d->{AvailableSpace} *=100; my $AvailUsed = $AvailableSpace /= $d->{TotalSize}; my $SpaceLeft = $d->{AvailableSpace} /= $AvailUsed; my $MappedDriveSpaceAvailable = $AvailUsed *= 100; print "em_result=$MappedDriveSpaceAvailable";

    Now, there are the errors

    GetDrive failed Bad file descriptor at E:\APPL\OEM\NetworkDriveCheck.pl line 9.

      Weird... What is that Y: drive, then? A mapped network share? Can you see its properties the "normal" way?

      Is it in the Drives collection? - i.e. would my code snippet try to list it?

        Y drive is a network drive. Here are the results of the snippet

        DriveLetter: Y DriveType: 3 IsReady: 1 FileSystem: NTFS TotalSize: 2594847440896 Use of uninitialized value in concatenation (.) or string at E:\APPL\O +EM\checkdr ive.pl line 14. FreeSpac: Use of uninitialized value in concatenation (.) or string at E:\APPL\O +EM\checkdr ive.pl line 14.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1105993]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2024-04-19 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found