from ctypes import * import time import win32file run = True logfile = open('.//log.out','w+');#open log file input = raw_input("Input a string for disk name like /'d:/' or other:")#input a disk name while run: sectorsPerCluster, bytesPerSector, numFreeClusters, totalNumClusters = / win32file.GetDiskFreeSpace(input) freespace = (numFreeClusters * sectorsPerCluster * bytesPerSector) /(1024 * 1024)#get free space logfile.write("%s %s FreeSpace is %d MBytes/n" % (time.asctime(),input,freespace));#write log print time.asctime(),input,"FreeSpace is",freespace,"MBytes"#output to screen time.sleep(3)#wait 3 second logfile.close();#close log file
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/8306.html