# -*- coding: cp1252 -*-
import win32net, win32file, win32netcon, win32wnet
def getPcs():
(l, t, r) = win32net.NetServerEnum(None, 100, win32netcon.SV_TYPE_AFP, None , 0, win32netcon.MAX_PREFERRED_LENGTH)
return (i['name'] for i in l)
def getResources(host=''):
(l, t, r) = win32net.NetShareEnum(host, 1, 0, -1)
for i in l:
print i
def getInfo(host=''):
dic = win32net.NetServerGetInfo(host, 100)
print dic
def shareInfo(host=''):
print win32net.NetShareGetInfo(host, 'c$',1)
def pcInfo(host=''):
print win32net.NetWkstaGetInfo(host, 100)
def diskEnum(host=''):
return win32net.NetServerDiskEnum(host, 0)
def diskFreeInfo(path):
(a, b, c, d) = win32file.GetDiskFreeSpace(path)
print 'scetors per cluster: ', a
print 'bytes per sector: ', b
print 'number of free clusters: ', c
print 'total numbers of clusters:', d
print '--------------------------'
print 'total espaco livre: ', a*b*c, ' bytes'
print 'capacidade total: ', a*b*d, ' bytes'
def copyFile(source, destino):
win32file.CopyFile(source, destino, 1)