def get_free_disk_bytes(dirname):
 if platform.system().lower().startswith('win'):
  free_bytes = ctypes.c_ulonglong(0)
  ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(dirname), None, None, ctypes.pointer(free_bytes))
  return free_bytes.value
 else:
  st = os.statvfs(dirname)
  return (st.f_bavail * st.f_frsize)

def get_free_disk_bytes ( dirname ) : if platform . system ( ) . lower ( ) . startswith ( 'win' ) : free_bytes = ctypes . c_ulonglong ( 0 ) ctypes . windll . kernel32 . GetDiskFreeSpaceExW ( ctypes . c_wchar_p ( dirname ) , None , None , ctypes . pointer ( free_bytes ) ) return free_bytes . value else : st = os . statvfs ( dirname ) return ( st . f_bavail * st . f_frsize )
return folder/drive free space in bytes .