find free hard disk space remote windows host

Daniel daniel.watrous at gmail.com
Mon Aug 31 12:11:46 EDT 2009


Hello,

I'm trying to determine the amount of free hard disk space on a remote
windows host.  Seems like this should be simple, but it's giving me
grief.  Here's what I've tried:

>>> mystat = os.stat('//remotehost/share/')
>>> mystat
(16895, 0L, 0, 0, 0, 0, 0L, 1251731920, 1251731289, 1249399952)

For some reason it doesn't show the details about space on the remote
path.

Next I tried this:

subprocess.call('dir //remotehost/share/ | find "bytes free"',
shell=True)

But this only returns the status, not the output, which is what I
need.

How can I determine the amount of free hard drive space on a remote
windows host using python?

Thanks



More information about the Python-list mailing list