but only returns zero for remote servers.
If the total bytes count is zero, it probably means that the call is failing--perhaps the userid you are running under does not have permissions on the remote server. If you check the return code from the call (which you should be doing anyway), then $^E would probably tell you why it is failing.
BTW: The way you are calling the function twice, with list slices, to get two values that are both returned each time you make the call, is really crap coding. Try something like this:
use Win32::DriveInfo; use constant { SECTORS_PER_CLUSTER => 0, BYTES_PER_SECTOR => 1, FREE_CLUSTERS => 2, TOTAL_CLUSTERS => 3, BYTES_FREE_4_CALLER => 4, TOTAL_BYTES => 5, TOTAL_FREE => 6, }; my @info = Win32::DriveInfo::DriveSpace('\\\\server01\\d\$\\') or die "DriveSpace failed with error: $^E"; printf "%.3f GB free of total %.3f GB\n", $info[ TOTAL_FREE ] / 1024**3, $info[ TOTAL_BYTES ] / 1024**3;
In reply to Re: Trying to get drive space info on remote Windows servers
by BrowserUk
in thread Trying to get drive space info on remote Windows servers
by Cloudster
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |