Estimating free flash file space
Some Digi products support the standard Python os.statvfs() function to query FLASH filesystem stats. Note that due the realities of file system overhead, allocating a file of size X, then freeing that file may not return the free/used statistics to the exact same condition.
Below is an example code which runs on a Digi ConnectPort X4 or Connect SP.
import os import traceback try: x = os.statvfs("WEB") print 'raw', x total = x[0] * x[2] free = x[0] * x[3] used = total - free print 'total:%0.2fMB free:%0.2fMB used:%0.2fMB' % \ (total/1000000.0, free/1000000.0, used/1000000.0) except: traceback.print_exc() print "perhaps this product does not have YAFFS?"